题目链接:hdu 4722 Good Numbers
题目大意:给出a,b,问从a到b之间,有多少个好数字,好数字的定义为:每个位的数字相加是10的倍数。
解题思路:dp[i][j]表示第i位,前i-1位的和为j(j可以从200简化成10,以为只需要考虑最后的数是否是10的倍数即可)有多少个数,需要注意的就是恰好为b的情况,所以要有一个跟踪值s。
#include
...
分类:
其他好文 时间:
2014-05-10 09:46:45
阅读次数:
232
Given a triangle, find the minimum path sum from
top to bottom. Each step you may move to adjacent numbers on the row below.For
example, given the fol...
分类:
其他好文 时间:
2014-05-08 21:08:25
阅读次数:
407
练习题(这里贴的是自己写的代码,
网上给的题目代码我会附加在最下面)1.编写shell脚本,计算1-100的和; 1 #!/bin/bash 2 #caculate the sum of
numbers from 1 to 100 3 4 sum=0 5 for i in `seq 1 100`;....
分类:
其他好文 时间:
2014-05-07 19:34:54
阅读次数:
305
The Little Elephant likes permutations. This time he has a permutation A[1], A[2], ..., A[N] of numbers 1, 2, ...,N.
He calls a permutation A good, if the number of its inversions is equal to the n...
分类:
其他好文 时间:
2014-05-07 07:20:50
阅读次数:
356
Problem:In the 2020 grid below, four numbers
along a diagonal line have been marked in red.08 02 22 97 38 15 00 40 00 75 04
05 07 78 52 12 50 77 91 08...
分类:
其他好文 时间:
2014-05-06 14:35:55
阅读次数:
460
尝试用两头分别比较的方法,结果发现无法解决1000021这种问题 1 public class
Solution { 2 public boolean isPalindrome(int x) { 3 if(x= 10) { 6 div *= 10;
7...
分类:
其他好文 时间:
2014-05-06 10:39:40
阅读次数:
241
We consider permutations of the numbers 1,..., N
for some N. By permutation we mean a rearrangment of the
number 1,...,N. For example
2 4 5 1 7 6 3 8
is a permutation of 1,2,...,8. Of cours...
分类:
其他好文 时间:
2014-05-04 18:38:14
阅读次数:
341
Given a collection of numbers that might
contain duplicates, return all possible unique permutations.For
example,[1,1,2]have the following unique perm...
分类:
其他好文 时间:
2014-05-04 10:20:44
阅读次数:
240
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets
so as the following conditions hold:
The product of all numbers in the first set is less ...
分类:
其他好文 时间:
2014-05-03 23:51:19
阅读次数:
621
Let's consider a triangle of numbers in which a number appears in the first line, two numbers appear in the second line, three in the third line, etc. Develop a program which will compute the largest ...
分类:
其他好文 时间:
2014-05-03 17:32:22
阅读次数:
284