摘要:
2011-12-16 07:52:18地址:http://acm.hdu.edu.cn/showproblem.php?pid=2069题意:有1、5、10、25、50一共五种硬币,问取不超过100枚组成n的种类有多少。mark:一开始没看到不超过100枚的条件。这题母函数不好做,直接dp吧。dp[i][j][k]表示用前i种硬币j枚组成面额k的种类数,转移方程是dp[i][j][k] = dp[i-1][j][k] +dp[i][j-1][k-tab[i]]。数据小,各种暴力吧。代码:# include <stdio.h>int dp[5][110][300] ;int ans[ 阅读全文
posted @ 2012-01-06 17:22
Seraph2012
阅读(301)
评论(0)
推荐(0)
摘要:
2011-12-16 07:58:56地址:http://acm.hdu.edu.cn/showproblem.php?pid=1020题意:把给的字符串编码,如sample。代码:# include <stdio.h>char str[10010] ;int calc(char s[]){ int i, cnt = 0 ; for (i = 0 ; s[i] ; i++) { if (s[i] != s[0]) break ; cnt++ ; } return cnt ;}int main (){ int T, i, n ; ... 阅读全文
posted @ 2012-01-06 17:22
Seraph2012
阅读(156)
评论(0)
推荐(0)
摘要:
2011-12-16 07:23:13地址:http://acm.hdu.edu.cn/showproblem.php?pid=1398题意:有1、4、9、16.。。289种面额的硬币无数枚(平方数),组成面值为n的方法有多少种。mark:典型母函数题,不过dp,直接YY出了递推公式,也不难。代码:# include <stdio.h>int dp[20][350] ;int tab[20] = {0, 1} ;int init(){ int i, j ; for (i = 2 ; i <= 17 ; i++) tab[i] = i*i ; for (i = 0... 阅读全文
posted @ 2012-01-06 17:21
Seraph2012
阅读(149)
评论(0)
推荐(0)
摘要:
2011-12-16 07:00:16地址:http://acm.hdu.edu.cn/showproblem.php?pid=2139题意:算平方和的奇数项目。mark:1wa,没用long long。公式是(4*p*p*p+12*p*p+11*p+3)/3。其中2p+1 == n。代码:# include <stdio.h>int main (){ long long n, p ; while (~scanf ("%I64d", &n)) { p = (n-1) / 2 ; printf ("%I64d\n", (4*p*p*p+ 阅读全文
posted @ 2012-01-06 17:20
Seraph2012
阅读(137)
评论(0)
推荐(0)
摘要:
2011-12-16 07:07:36地址:http://acm.hdu.edu.cn/showproblem.php?pid=2188题意:中文,博弈。mark:结论是:如果n%(m+1)==0则先手败。代码:# include <stdio.h>int main (){ int T, n, m ; scanf ("%d", &T) ; while (T--) { scanf ("%d%d", &n, &m) ; if (n % (m+1) == 0) puts ("Rabbit") ; else 阅读全文
posted @ 2012-01-06 17:20
Seraph2012
阅读(126)
评论(0)
推荐(0)
摘要:
2011-12-16 06:45:55地址:http://acm.hdu.edu.cn/showproblem.php?pid=2131题意:问给的字母在后面单词中出现的比例是多少。注意不区分大小写。代码:# include <stdio.h>char word[210] ;int main (){ char ch ; int i, sum ; while (~scanf ("%c %s%*c", &ch, word)) { sum = 0 ; for (i = 0 ; word[i] ; i++) if ((word[... 阅读全文
posted @ 2012-01-06 17:19
Seraph2012
阅读(208)
评论(0)
推荐(0)
摘要:
2011-12-16 06:40:40地址:http://acm.hdu.edu.cn/showproblem.php?pid=2124题意:用n个长度各不相同的方块堵住长度为L的墙。可以锯,问最少需要多少块。mark:简单题,贪心。排序即可。wa了几百次!!!搞了40分钟!!!尼玛没考虑到impossible的时候数组越界啊我日!!!太2了。条件i < n+1 没写。其实还有一个bug,就是n==0的情况。不过ac了,就不鸟它了。网上说要用long long,其实int都可以过的。。。# include <stdio.h># include <stdlib.h> 阅读全文
posted @ 2012-01-06 17:18
Seraph2012
阅读(218)
评论(0)
推荐(0)
摘要:
2011-12-16 05:53:55地址:http://acm.hdu.edu.cn/showproblem.php?pid=2061题意:算n个成绩的GPA(不是平均学分绩点,是平均学分成绩)。mark:坑爹,s<60写成了s<=60。另外把%lf改成%d居然会TLE。代码:# include <stdio.h>char name[35] ;int main (){ int T, n, flag, nCase = 1 ; double c, s ; double tc, ts ; scanf ("%d%*c", &T) ; while ( 阅读全文
posted @ 2012-01-06 17:12
Seraph2012
阅读(225)
评论(0)
推荐(0)
摘要:
2011-12-16 05:30:25地址:http://acm.hdu.edu.cn/showproblem.php?pid=1202题意:中文,算GPA。mark:wa了2次,pe了1次。没看到”如GPA不存在,输出-1“这个条件。。。代码:# include <stdio.h>double point(double p){ if (p >= 90) return 4 ; if (p >= 80) return 3 ; if (p >= 70) return 2 ; if (p >= 60) return 1 ; return 0 ;}int main 阅读全文
posted @ 2012-01-06 17:10
Seraph2012
阅读(181)
评论(0)
推荐(0)
摘要:
2011-12-16 05:39:05地址:http://acm.hdu.edu.cn/showproblem.php?pid=2060题意:斯诺克游戏。输入a,b,c表示剩下的球数,p的分数,o的分数。现在p打,假设p一杆清,问p的分数是否追得上o。代码:# include <stdio.h>int calc(int n){ int tab[] = {0, 7, 13, 18, 22, 25, 27} ; if (n <= 6) return tab[n] ; return 8*(n-6) + tab[6] ;}int main (){ int T ; int ... 阅读全文
posted @ 2012-01-06 17:10
Seraph2012
阅读(138)
评论(0)
推荐(0)

浙公网安备 33010602011771号