hdoj 1163 Eddy's digital Roots(数学问题讲究的是分析,找规律)
超级传送门:
http://acm.hdu.edu.cn/showproblem.php?pid=1163
题目大意:
The Eddy's easy problem is that : give you the n,want you to find the n^n's digital Roots
给你一个n,输出n^n 的数根,树根就是 求各个位数的和 ,如果和是多位数,就继续求和,直到和为一位数。
题目分析:
这篇我想慢慢写,用各种方法,下面,我先贴一个找规律的结果的代码,
找规律的代码:(出处http://hi.baidu.com/zf2650/blog/item/bd13eeac26a776054a36d65a.html)
记得高中奥数老师教的,数字越大越不用怕,有规律的
int main()
{
int i,n;
int a[19]={0,1,4,9,4,2,9,7,1,9,1,5,9,4,7,9,7,8,9};
while(cin>>n&&n)
{
int m=n%18==0?18:n%18;
cout<<a[m]<<endl;
}
return 1;
}
hdoj 1163 Eddy's digital Roots(数学问题讲究的是分析,找规律)相关推荐
- HDU1163 Eddy's digital Roots(解法二)【快速模幂+九余数定理】
问题链接:HDU1163 Eddy's digital Roots. 问题简述:参见上述链接. 问题分析:计算n^n的数根,一要快,二要简单.使用快速模幂计算,加上数论中的九余数定理就完美了. 程序说 ...
- HDU1163 Eddy's digital Roots(解法二)【快速模幂+九余数定理】(废除!!!)
本文废除,参见下述链接. 参考链接:HDU1163 Eddy's digital Roots[快速模幂+九余数定理+水题] 问题链接:HDU1163 Eddy's digital Roots. 问题简 ...
- 数学--数论--HDU - 6322 打表找规律
In number theory, Euler's totient function φ(n) counts the positive integers up to a given integer n ...
- HDU1013 POJ1519 Digital Roots(解法二)
该问题的最佳解法是利用数论的9余数定理来计算数根.一个数的数根等于该数的9的余数,若余数为0则结果为9. 问题链接:HDU1013 POJ1519 Digital Roots.入门练习题,用C语言编写 ...
- HDU1013 POJ1519 Digital Roots
该问题的最佳解法是利用数论的9余数定理来计算数根.一个数的数根等于该数的9的余数,若余数为0则结果为9. 问题链接:HDU1013 POJ1519 Digital Roots.基础训练题,用C语言编写 ...
- HDU1013 POJ1519 Digital Roots(解法三)【废除!!!】
本文废除!!! 参见链接:HDU1013 POJ1519 UVALive2085 Digital Roots[数根+水题] 该问题的最佳解法是利用数论的9余数定理来计算数根.一个数的数根等于该数的9的 ...
- HDU1013 POJ1519 Digital Roots(解法二)【废除!!!】
本文废除!!! 参见链接:HDU1013 POJ1519 UVALive2085 Digital Roots[数根+水题] 该问题的最佳解法是利用数论的9余数定理来计算数根.一个数的数根等于该数的9的 ...
- HDU1013 POJ1519 Digital Roots(解法三)
该问题的最佳解法是利用数论的9余数定理来计算数根.一个数的数根等于该数的9的余数,若余数为0则结果为9. 问题链接:HDU1013 POJ1519 Digital Roots.入门练习题,用C语言编写 ...
- Digital Roots
题目的链接为: http://acm.njupt.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1028 题目为: Dig ...
- 数学/找规律/sgu 118 Digital root
题意 定义f(n)为n各位数字之和,如果n是各位数,则n个数根是f(n),否则为f(n)的数根 现在给出n个Ai,求出A1*A2*-*AN + A1*A2*-*AN-1 + - + A1*A2 + A ...
最新文章
- PAT (Advanced Level) 1016 Phone Bills(恶心模拟)
- CSDN,CNBLOGS博客文章一键转载插件 终于更新了!
- ansible inventory 主机清单配置
- Qt学习笔记-编写简易的音乐播放器
- 黄章diss小米9:贱人贱己贱行业 之后秒删
- hiveserver2总是启动不起来
- Qt学习笔记常用容器
- Guava学习笔记(1)--安全地使用null(Using and avoiding null)
- Java-web下使用RSA进行加密解密操作
- mini2440 SD卡脱机烧写恢复
- mac 版本charles安装报错-Charles cannot configure your proxy settings while it is on a read-only volume.
- Windows 10无法显示无线网络连接
- 西游记笔记与想法(2)
- 【Gazebo入门教程】第四讲 场景建模/建筑编辑器
- js json数据去重。json数据如何将相邻的一条数据的重复数据删掉,通过key判断值相等的
- hash算法原理详解
- 操作系统期末知识点总结
- 【Android】第三方QQ账号登录的实现
- JRebel热部署,从此告别一遍一遍重启项目
- [固态硬盘协议 第2回] PCIE 相对 SATA 的 4 大优势详解