Simple DP.Scanning from the end. If current is 0, then no ways as "0", but it can be treated as "10", "20". So do another check whether it can has oth...
分类:
其他好文 时间:
2015-03-19 07:45:43
阅读次数:
148
Two notes:1. I dont know whether C++ has a good split function for STL as the JAVA. Need to figure it out.2. At the beginning, I tried to set tmp1 = t...
分类:
其他好文 时间:
2015-03-19 06:17:36
阅读次数:
130
生活很心酸?8招支撑你度过困难时期 No matter what problem you're facing, tough times happen to the best of us. Whether it's financial trouble or just an overall bad d....
分类:
其他好文 时间:
2015-03-18 10:29:52
阅读次数:
122
problem:
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of conv...
分类:
其他好文 时间:
2015-03-17 22:00:59
阅读次数:
163
Determine whether an integer is a palindrome. Do this without extra space.(source)判断一个数字是否为回文数,并且不使用额外的存储空间。“回文”是指正读反读都能读通的句子,那么回文数,就很容易理解,就是指一个数正反读的值是相同的。还有一个要求是不要使用额外的存储空间。Hints:
要将一个数的最高位与最低位比较,取出一...
分类:
其他好文 时间:
2015-03-16 17:45:42
阅读次数:
142
Problem Description
Write a program to read in a list of integers and determine whether or not each number is prime. A number, n, is prime if its only divisors are 1 and n. For this problem, the numbers 1 and 2 are not considered primes.
Input
Each inp...
分类:
其他好文 时间:
2015-03-13 14:24:56
阅读次数:
130
http://acm.hdu.edu.cn/showproblem.php?pid=5183
Problem Description
When given an array (a0,a1,a2,?an?1) and
an integer K,
you are expected to judge whether there is a pair (i,j)(0≤i≤jn) wh...
分类:
其他好文 时间:
2015-03-11 23:28:53
阅读次数:
205
题意:When given an array(a0,a1,a2,?an?1)and an integerK, you are expected to judge whether there is a pair(i,j)(0≤i≤j st;ll ans,K;int n;int T;ll a[10000...
分类:
其他好文 时间:
2015-03-11 21:20:46
阅读次数:
143
题目:
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
/ 2 2
/ \ / 3 4 4 3
But the fo...
分类:
其他好文 时间:
2015-03-11 17:19:41
阅读次数:
143
Palindrome Number问题:Determine whether an integer is a palindrome. Do this without extra space.思路:常用的进制遍历方法while(num != 0){ remian = num % 进制; ...
分类:
其他好文 时间:
2015-03-11 12:07:14
阅读次数:
148