上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 51 下一页
摘要: 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 阅读(134) 评论(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 阅读(133) 评论(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 阅读(115) 评论(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 阅读(203) 评论(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 阅读(206) 评论(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 阅读(210) 评论(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 阅读(168) 评论(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 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 05:20:42地址:http://acm.hdu.edu.cn/showproblem.php?pid=2111题意:中文,拆分背包,直接贪心。代码:# include <stdio.h># include <stdlib.h>typedef struct node{ int v, p ;}node ;node a[110] ;int min(int a, int b){return a<b?a:b;}int cmp(const void *a, const void *b){ node *p = (node*)a, *q = (node* 阅读全文
posted @ 2012-01-06 17:09 Seraph2012 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 05:06:54地址:http://acm.hdu.edu.cn/showproblem.php?pid=2049题意:中文。错排+组合。mark:wa了一次。。。忘记写dp的递推。2B了。代码:# include <stdio.h>long long dp[25] = {0, 0, 1} ;long long c[25][25] ;void init(){ int i, j ; for (i = 3 ; i <= 20 ; i++) dp[i] = (i-1)*(dp[i-1]+dp[i-2]) ; for (i = 0 ; i<=20 ... 阅读全文
posted @ 2012-01-06 17:08 Seraph2012 阅读(145) 评论(0) 推荐(0) 编辑
上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 51 下一页