题目
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent
a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find ...
分类:
其他好文 时间:
2014-07-08 21:43:08
阅读次数:
219
http://acm.hdu.edu.cn/showproblem.php?pid=4722
大致题意:若一个整数的各位数字之和是10的倍数,称这个数为"good number"。给出区间[A,B],求出该区间内"good number"的数的个数。
第一道数位dp,折腾了半天才明白怎么回事。
设dp[site][mod]表示到第site位(由高位向低位)前面各位数字之和对1...
分类:
其他好文 时间:
2014-07-08 20:46:41
阅读次数:
223
Minimum Inversion Number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9864 Accepted Submission(s): 6069
Problem Description
T...
分类:
其他好文 时间:
2014-07-08 19:15:43
阅读次数:
232
两种方法翻转一个整数,顺序翻转和递归翻转这里没考虑overflow的情况递归的作用是使得反向处理,即从递归栈的最低端开始处理,通过画图可得。如果是rec(num/10):123451234123121 package recursion;
public class Reverse_digits_of_a_number {
public static void main(Str...
分类:
其他好文 时间:
2014-07-08 18:34:14
阅读次数:
208
The string "PAYPALISHIRING" is written in a zigzag pattern on a given
number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I...
分类:
其他好文 时间:
2014-07-08 17:42:31
阅读次数:
192
一种方法是先翻转当前数,然后把它和原数比较(略)另一种是递归方法,借用一个复制数,对原数递归,使之翻转,然后配合复制数比较package recursion;
public class Check_if_a_number_is_palindrome {
public static void main(String[] args) {
int num = 121321;
System....
分类:
其他好文 时间:
2014-07-08 17:13:55
阅读次数:
188
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1394...
分类:
其他好文 时间:
2014-07-08 16:27:04
阅读次数:
138
Method 4: Gets the value of element number i
For example, if list is {22, 33, 44, 55, 66, 77, 88, 99}, then get(list, 2) will return 44.
Solution 1:
static int get(Node list, int i) {
if (i < 0) ...
分类:
其他好文 时间:
2014-07-08 14:07:52
阅读次数:
262
http://acm.hdu.edu.cn/showproblem.php?pid=3652
大致题意:"B-number"即一个整数含有子串"13"且被13整除。求1-n之间这样的数的个数。
思路:有两个限制条件:含有子串“13”和能被13整除。那么设dp[site][mod][flag],表示到第site位对13取余为mod且标记为flag的数的个数。flag表示是否含有子...
分类:
其他好文 时间:
2014-07-08 13:43:12
阅读次数:
173
方法二:利用SVN自身的revision number。最高效的方法是在关键commit时说明打基线,或者说明关键要点,比如评审后修改再复核通过,比如评审通过。
方法二更加正式的做法是利用专门的表格记录关键点的Revision Number...
分类:
其他好文 时间:
2014-07-08 13:19:15
阅读次数:
309