题目链接: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
??
Lost Cows
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 8838
Accepted: 5657
Description
N (2 <= N <= 8,000) cows have unique brands in the range 1..N. ...
分类:
其他好文 时间:
2014-05-07 07:58:26
阅读次数:
337
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
'''
【程序1】
题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
1.程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去
掉不满足条件的排列。
2.程序源代码:
'''
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
...
分类:
编程语言 时间:
2014-05-07 06:02:59
阅读次数:
301
[Question]
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to t...
分类:
其他好文 时间:
2014-05-07 05:37:44
阅读次数:
278
题目链接: SCUT 2014
题目大意: 判断给出的字符串中是否是正确的科学计数法
A+1.5Be+8C,可以是实数或者含有指数的实数,ABC三个部分表示空格,可有可无,正负号可有可无
指数部分只能是整数
解题思路: 建立有穷自动机状态转移表,一共是10种状态...
分类:
其他好文 时间:
2014-05-07 05:32:27
阅读次数:
330
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4722
思路:数位dp,dp[i][j]表示到第i位,数字和%10为j,然后进行dp,注意完全匹配的情况是要+1,而其他情况是从0 到 9 都要考虑
代码:
#include
#include
#include
#include
using namespace std;
int t;
l...
分类:
其他好文 时间:
2014-05-07 04:55:37
阅读次数:
314
Subtraction Game 1
Chef is playing a game on a sequence of N positive integers, say A1, A2, ... AN. The game is played as follows.
If all the numbers are equal, the game ends.Otherwise
Sele...
分类:
其他好文 时间:
2014-05-07 03:14:01
阅读次数:
280
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-07 02:55:24
阅读次数:
377
Problem:The sequence of triangle numbers is
generated by adding the natural numbers. So the 7thtriangle number would be 1 +
2 + 3 + 4 + 5 + 6 + 7 = 28...
分类:
其他好文 时间:
2014-05-07 00:28:01
阅读次数:
365