Add DigitsGiven a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is...
分类:
其他好文 时间:
2015-08-16 15:11:22
阅读次数:
80
Number of Digit OneGiven an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Gi...
分类:
其他好文 时间:
2015-08-16 13:41:46
阅读次数:
124
Thedigital root(alsorepeated digital sum) of anon-negative integeris the (single digit) value obtained by an iterative process ofsumming digits规律题题意 ....
分类:
其他好文 时间:
2015-08-16 12:01:55
阅读次数:
98
求一个数阶乘的位数flyfish 2015-8-15例如 7!=5040 ,7的阶乘结果是4位数(10进制)求一个数的位数1 循环方法int get_digit_loop(int N)
{
int digit = 0;
do
{
digit ++;
} while ((N /= 10) > 0);
return digit;
}2 递归方式i...
分类:
其他好文 时间:
2015-08-16 00:45:34
阅读次数:
109
Problem Description
The reflected binary code, also known as Gray code after Frank Gray, is a binary numeral system where two successive values differ in only onebit (binary digit). The reflected b...
分类:
其他好文 时间:
2015-08-15 18:26:59
阅读次数:
127
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:
其他好文 时间:
2015-08-14 15:16:01
阅读次数:
93
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2015-08-14 11:45:41
阅读次数:
88
题意:把n个数(1-9)放到A集合和B集合里面去,使得A集合里面的数的数根为a,B集合里面的数的数根为b,也可以只放在A或B任一个集合里面。求方法总数。比如A={2,4,5},则A的数根为[2+4+5]=[11]=[2]=2思路:一个数为a,则它的数根b=(a-1)%9+1=(digit-1)%9+...
分类:
其他好文 时间:
2015-08-13 20:06:49
阅读次数:
125
数据并不大,dfs回溯即可。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 30; 7 char str[N]; 8 int digit[N]; 9 10 int dfs( int sum ...
分类:
其他好文 时间:
2015-08-12 21:21:37
阅读次数:
131
233 Number of Digit One这道题是递归算法class Solution: # @param {integer} n # @return {integer} def countDigitOne(self, n): if n <= 0: ...
分类:
其他好文 时间:
2015-08-12 06:42:49
阅读次数:
114