Eddy's digital Roots
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4793 Accepted Submission(s): 2672
For example, consider the positive integer 24. Adding the 2 and the 4 yields a value of 6. Since 6 is a single digit, 6 is the digital root of 24. Now consider the positive integer 39. Adding the 3 and the 9 yields 12. Since 12 is not a single digit, the process must be repeated. Adding the 1 and the 2 yeilds 3, a single digit and also the digital root of 39.
The Eddy's easy problem is that : give you the n,want you to find the n^n's digital Roots.
4
0
思路:1.九余数定理 一个数的n的树根=(n-1)%9+1
2.N个整数的树根的乘机总值=每个项元素的树根的乘积
3.分步求余
#include<cstdio>
#include<cmath>
int main()
{
int n;
while(scanf("%d",&n)&&n)
{
int m=n;
int i;
int ans=;
m=(m-)%+;//先把底数m求树根,根据 N个整数的乘积带的树根=每项元素的树根的乘积
for(i=;i<=n;i++)
ans=(ans*m-)%+;//分步求余
printf("%d\n",ans);
}
}
Eddy's digital Roots的更多相关文章
- HDU 1163 Eddy's digital Roots
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- Eddy's digital Roots(九余数定理)
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- HDU-1163 Eddy's digital Roots(九余数定理)
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- HDOJ 1163 Eddy's digital Roots(九余数定理的应用)
Problem Description The digital root of a positive integer is found by summing the digits of the int ...
- HDOJ 1163 Eddy's digital Roots 九余数定理+简单数论
我在网上看了一些大牛的题解,有些知识点不是太清楚, 因此再次整理了一下. 转载链接: http://blog.csdn.net/iamskying/article/details/4738838 ht ...
- HDU 1163 Eddy's digital Roots(模)
HDU 1163 题意简单,求n^n的(1)各数位的和,一旦和大于9,和再重复步骤(1),直到和小于10. //方法一:就是求模9的余数嘛! (228) leizh007 2012-03-26 21: ...
- hdu 1163 Eddy's digital Roots 【九余数定理】
http://acm.hdu.edu.cn/showproblem.php?pid=1163 九余数定理: 如果一个数的各个数位上的数字之和能被9整除,那么这个数能被9整除:如果一个数各个数位上的数字 ...
- HDU1163 - Eddy's digital Roots
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1163 九余数:一个数除于9所得到的余数,即模9得到的值 求九余数: 求出一个数的各位数字之和,如果是两 ...
- HDU1163 Eddy's digital Roots【九剩余定理】
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
随机推荐
- Song Jiang's rank list
Song Jiang's rank list Time Limit:1000MS Memory Limit:512000KB 64bit IO Format:%I64d & ...
- cocos基础教程(1)Mac环境下搭建
下面主要介绍cocos2d-x环境的设置以及android的环境搭建 1.下载cocos2d-x 3.0正式版 http://www.cocos2d-x.org/download 2.下载a ...
- 使用mysql服务来记录用户的反馈
经过前几篇教程的学习,相信你对于微信的操作与SAE和webpy都有了些了解,那么这次我想加一个功能,通过mysql来记录用户的反馈,如用户输入fk+内容,然后通过一个页面来显示,最终的效果如下 htt ...
- Unable to execute dex: Multiple dex files define
这是一个编译错误,在ADT的编译器和SDK的工具有差异或是版本不一致时常会出现的一个问题,解决的方案如下: 第一步: updated eclipse (Help->Check for updat ...
- 淘宝(阿里百川)手机客户端开发日记第九篇 Looper详解
public final class Looper: 官方的API: Class used to run a message loop for a thread. Threads by default ...
- [BZOJ3670][UOJ#5][NOI2014]动物园
[BZOJ3670][UOJ#5][NOI2014]动物园 试题描述 近日,园长发现动物园中好吃懒做的动物越来越多了.例如企鹅,只会卖萌向游客要吃的.为了整治动物园的不良风气,让动物们凭自己的真才实学 ...
- MotionEvent常见值
常见的动作常量: public static final int ACTION_DOWN = 0;单点触摸动作 public static final int ACTION_UP ...
- HDU1879 kruscal 继续畅通工程
继续畅通工程 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Subm ...
- 12 day 1
#include <cstdio> int i,j,m,n,t; long long f[6000][6000]; inline int min(int a,int b){ return ...
- winform 添加“设置文件”
添加配置文件 ·右击服务项目---添加新项---设置文件:----确定 ·把Settings1.settings,拖到properties里,双击Settings1.settings: 名称:是自己定 ...