题目大意: 给定一个正整数,根据一定的规则求出该数的“数根”,其规则如下: 例如给定 数字 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的“数根”. 通过运算可以发现任何一个数的“数根”都是一个取值…
我在网上看了一些大牛的题解,有些知识点不是太清楚, 因此再次整理了一下. 转载链接: 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…
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…
题目链接 #include <iostream> using namespace std; int main() { string a; int b; ") { b = ; ;i < a.length();i ++) { b += a[i] - '; } b = b % ;//九余数定理:所有位置上数字之和%9 == 这个数字%9 ) b = ;//90 输出9,否则%9输出0 cout << b << endl; } ; }…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1163 九余数:一个数除于9所得到的余数,即模9得到的值 求九余数: 求出一个数的各位数字之和,如果是两位数以上,则再求各位数字之和,直到只有一位数时结束. 如果求出的和是9,则九余数为0:如果是其他数,则这个数为九余数. 解题思路:快速幂+九余数 先求出九余数,如果九余数为0,则ans=9:如果是其他数,则ans=九余数. #include <iostream> using namespace s…
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): 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): 4436    Accepted Submission(s): 2505 Problem Description The digital root of a positive integer is found by summing the digi…
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…
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4632    Accepted Submission(s): 2578 Problem Description The digital root of a positive integer is found by summing the digi…