我在网上看了一些大牛的题解,有些知识点不是太清楚, 因此再次整理了一下. 转载链接: http://blog.csdn.net/iamskying/article/details/4738838 http://www.2cto.com/kf/201405/297531.html 题目描述:求n^n次的digital root(数根),例如root(67)=6+7=root(13)=1+3=4; 一类解法: 求解思路:现在分析一个问题,假设将十位数为a,个位数为b的一个整数表示为ab,则推导得ab…
Problem Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits a…
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5783    Accepted Submission(s): 3180 Problem Description The digital root of a positive integer is found by summing the digit…
http://acm.hdu.edu.cn/showproblem.php?pid=1163 九余数定理: 如果一个数的各个数位上的数字之和能被9整除,那么这个数能被9整除:如果一个数各个数位上的数字之和被9除余数是几,那么这个数被9除的余数也一定是几. 证明: 首先10^i =99...9(i个9) +1除以9的余数=1 所以ai*10^i除以9的余数=ai 用a0~an表示各位数字则数=(anan-1an-2.a2a1a0), =an*10^n+an-1*10^n-1 +an-2 *10^n…
题目大意: 给定一个正整数,根据一定的规则求出该数的“数根”,其规则如下: 例如给定 数字 24,将24的各个位上的数字“分离”,分别得到数字 2 和 4,而2+4=6: 因为 6 < 10,所以就认为6是数字24的“数根”: 而对于数字 39 , 将39的各个位上的数字“分离”,分别得到数字 3 和 9,而3+9=12,且12>10: 所以依据规则再对 12 进行相应的运算,最后得到数字3,而3<10,所以就认为3是数字39的“数根”. 通过运算可以发现任何一个数的“数根”都是一个取值…
HDU 1163 题意简单,求n^n的(1)各数位的和,一旦和大于9,和再重复步骤(1),直到和小于10. //方法一:就是求模9的余数嘛! (228) leizh007 2012-03-26 21:03:19 (确实可行) #include<stdio.h> #include<string.h> int main() { int n,i,ans; while(scanf("%d",&n),n) { ans=; ;i<n;i++) { ans=(a…
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5113    Accepted Submission(s): 2851 Problem Description The digital root of a positive integer is found by summing the digit…
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5183    Accepted Submission(s): 2897 Problem Description The digital root of a positive integer is found by summing the digit…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4793    Accepted Submission(s): 2672 Problem Description The digital root of a positive integer is found by summing the digits of the integer. If…
下午做了NYOJ-424Eddy's digital Roots后才正式接触了九余定理,不过这题可不是用的九余定理做的.网上的博客千篇一律,所以本篇就不发篇幅过多介绍九余定理了: 但还是要知道什么是九余定理: 九余数定理 一个数对九取余后的结果称为九余数. 一个数的各位数字之和相加后得到的<10的数字称为这个数的九余数(如果相加结果大于9,则继续各位相加) 简单的说就是:一个整数模9的结果与这个整数的各位数字之和模9的结果相同: 以前做题不知道有这个定理一般暴力就过了,求数位和也不复杂,只不过更…