题意: 有N个志愿者.指挥部需要将他们分成若干组,但要求每个组的人数必须为素数.问不同的方案总共有多少.(N个志愿者无差别,即每个组的惟一标识是:人数) 思路: 假设N个人可分为K组,将这K组的人数从小到大排序,num1,...,numk. 故N个人分组的方案数dp[n]=sum(dp[numk]) (所有分为K组的不同方案的和) 代码: bool yes[155]; int prime[155]; int dp[155]; int main(){ mem(yes,true); int C =…
Square Coins Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7883 Accepted Submission(s): 5332 Problem Description People in Silverland use square coins. Not only they have square shapes but…
排列组合 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3438 Accepted Submission(s): 1439 Problem Description 有n种物品,并且知道每种物品的数量.要求从中选出m件物品的排列数.例如有两种物品A,B,并且数量都是1,从中选2件物品,则排列有"AB","BA&…
题目 Source http://acm.hust.edu.cn/vjudge/problem/23590 Description I have a set of super poker cards, consisting of an infinite number of cards. For each positive composite integer p, there are exactly four cards whose value is p: Spade(S), Heart(H),…
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=4609 Description King OMeGa catched three men who had been streaking in the street. Looking as idiots though, the three men insisted that it was a kind of performance art, and begged the king to fre…
The Balance Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5706 Accepted Submission(s): 2311 Problem Description Now you are asked to measure a dose of medicine with a balance and a number o…
Big Event in HDU Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24002 Accepted Submission(s): 8458 Problem Description Nowadays, we all know that Computer College is the biggest department…
ps:原来用新浪,可是代码的排版不是很好,所以用博客园啦,先容许我把从八月份开始的代码搬过来,从这里重新出发,希望这里可以一直见证我的成长. Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9186 Accepted Submission(s): 5591 Problem Description 在一个国家仅有1分,2分,3分硬币,…
母函数的简单应用http://acm.hdu.edu.cn/showproblem.php?pid=2079 介绍见另一篇随笔HDU1028Ignatius and the Princess III(母函数) #include<stdio.h> int main() { int T; while(~scanf("%d", &T))while(T--) { ]={},c2[]={}; int num,val; int i,n,k; scanf("%d%d&q…