hdu1028(母函数+DP)】的更多相关文章

题目信息:求分解整数n的个数q(n);能够母函数或者DP http://acm.hdu.edu.cn/showproblem.php?pid=1028 AC代码: /****************************** 题目大意:求分解整数n的个数q(n) 例: 5 = 5; 5 = 4 + 1; 5 = 3 + 1 + 1; 5 = 3 + 2; 5 = 2 + 2 + 1; 5 = 2 + 1 + 1 + 1; 5 = 1 + 1 + 1 + 1 + 1; sum(5) = 7;不区…
hdu1021 给n,看费波纳列数能否被3整除 算是找规律吧,以后碰到这种题就打打表找找规律吧 #include <stdio.h> int main(void) { int n; while(scanf("%d", &n) != EOF) { == || n%==) printf("yes\n"); else printf("no\n"); } ; } hdu1022 栈的简单利用吧 给两个队列  看第一个队列是否可以用第二…
Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9903    Accepted Submission(s): 6789 Problem Description People in Silverland use square coins. Not only they have square shapes but…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1028 题意: 给你一个正整数n,将n拆分成若干个正整数之和,问你有多少种方案. 注:"4 = 3 + 1"和"4 = 1 + 3"视为同一种方案.(加数是无序的) 题解1(dp): 表示状态: dp[n][m] = num of methods 表示用均不超过m的元素组成n的方法数. 如何转移: 假设当前状态为dp[n][m]. 对于等于m的元素,有两种决策.要么不用,…
钱币兑换问题 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5069    Accepted Submission(s): 2868 Problem Description 在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法.请你编程序计算出共有多少种兑法.   Input 每行只有一个正整数N,N小于32768.   O…
Time limit per test: 2.0 seconds Memory limit: 512 megabytes 唐纳德先生的某女性朋友最近与唐纳德先生同居.该女性朋友携带一 baby.该 baby 酷爱吃棒棒糖,且有一个奇怪的特性:今天吃的棒棒糖一定要比昨天的棒棒糖更多,至少要一样多.如果棒棒糖少了,baby 就会很不高兴:另外如果有连续 k 天棒棒糖的数量都是一样的,baby 也会很不高兴. 唐纳德先生发现他的口袋里只有可怜的 n 元钱,他可以用 1 元钱买 1 根棒棒糖.他想用这些…
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 What is possibility of rolling N dice and the sum of the numbers equals to M? 输入 Two integers N and M. (1 ≤ N ≤ 100, 1 ≤ M ≤ 600) 输出 Output the possibility in percentage with 2 decimal places. 样例输入 2 10 样例输出 8.3…
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15942    Accepted Submission(s): 11245 Problem Description "Well, it seems the first problem is too easy. I will let…
Problem Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ...…
Problem Description "Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equation like this:  N=a[1]+a[2]+a[3]+...+a[m…