摘要: 2011-12-14 04:06:19地址:http://acm.hdu.edu.cn/showproblem.php?pid=2010题意:中文。。。代码:# include <stdio.h>int main (){ int i, a, b, flag ; int daff[4] = {153, 370, 371, 407} ; while (~scanf ("%d%d", &a, &b)) { flag = 0 ; for (i = 0 ; i < 4 ; i++) if (daff[i] >= a && daf 阅读全文
posted @ 2012-01-06 14:28 Seraph2012 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 2011-12-14 03:51:49地址:http://acm.hdu.edu.cn/showproblem.php?pid=2029题意:中文题。代码:# include <stdio.h># include <string.h>int IsPalindromes(char str[]){ int i, len = strlen (str) ; for (i = 0 ; i < len/2 ; i++) if (str[i] != str[len-i-1]) return 0 ; return 1 ;}int main (){ int n ; c... 阅读全文
posted @ 2012-01-06 14:27 Seraph2012 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 2011-12-14 03:40:00地址:http://acm.hdu.edu.cn/showproblem.php?pid=2021题意:中文题。代码:# include <stdio.h>int gao(int num){ int sum = 0, i, tab[] = {100, 50, 10, 5, 2, 1} ; for (i = 0 ; i < 6 ; i++) { sum += num / tab[i] ; num %= tab[i] ; } return sum ;}int main (){ int n, num... 阅读全文
posted @ 2012-01-06 14:26 Seraph2012 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 2011-12-14 03:47:02地址:http://acm.hdu.edu.cn/showproblem.php?pid=2022题意:中文题。代码:# include <stdio.h>int ABS(int n){return n<0?-n:n;}int main (){ int n, m, x, y ; int i, j, num, nnum, max ; while (~scanf ("%d%d", &n, &m)) { max = -1 ; for (i = 0 ; i < n ; i++) for (j... 阅读全文
posted @ 2012-01-06 14:26 Seraph2012 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 2011-12-12 05:46:08地址:http://acm.hdu.edu.cn/showproblem.php?pid=2014题意:中文题。mark:wa了3次!!!因为敲错变量!!!min敲成了num,各种二。可能是困了。代码:# include <stdio.h># define MAX(a,b) (a>b?a:b)# define MIN(a,b) (a<b?a:b)int main (){ int sum, max, min, num ; int n, i ; while (~scanf ("%d", &n)) { scan 阅读全文
posted @ 2012-01-06 14:25 Seraph2012 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 2011-12-12 05:57:29地址:http://acm.hdu.edu.cn/showproblem.php?pid=2018题意:中文题。mark:”第四年“意味着出生年隔2年。递推,方程是dp[i] = dp[i-1]+dp[i-3],就是去年的牛加上大前年能的牛生的宝宝们。代码:# include <stdio.h>int main (){ int i, dp[60] = {0, 1, 2, 3, 4} ; for (i = 4 ; i < 55 ; i++) dp[i] = dp[i-1]+dp[i-3] ; while (~scanf ("%.. 阅读全文
posted @ 2012-01-06 14:25 Seraph2012 阅读(237) 评论(1) 推荐(0) 编辑
摘要: 2011-12-12 05:27:32地址:http://acm.hdu.edu.cn/showproblem.php?pid=2012题意:中文题。mark:wa了一次,超2的。自己以为聪明地写了一个预处理,结果忘记把表达式写进去了,IsPrme的参数直接写了个i,太2了。代码:# include <stdio.h>int IsPrime(int n){ int i ; for (i = 2 ; i < n ; i++) if (n%i==0) break ; return i >= n ;}int main (){ int i, tab[100] = ... 阅读全文
posted @ 2012-01-06 14:24 Seraph2012 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 2011-12-12 05:18:17地址:http://acm.hdu.edu.cn/showproblem.php?pid=2017题意:中文题。mark:wa了一次,忘记在组数后加getchar。。。太2了。代码:# include <stdio.h>char str[1010] ;int main (){ int i, sum ; scanf ("%d", &i) ; getchar () ; while (gets(str)) { for (sum = 0, i = 0 ; str[i] ; i++) if (str[... 阅读全文
posted @ 2012-01-06 14:23 Seraph2012 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 2011-12-12 05:10:11地址:http://acm.hdu.edu.cn/showproblem.php?pid=2013题意:中文。思路:递推。设tab[n]表示第n天的桃子数。由题意知tab[n]/2-1 = tab[n-1],可得tab[n] = (tab[n-1]+1)*2。代码:# include <stdio.h># include <math.h>int main (){ int i, tab[30] = {0, 1} ; for (i = 2 ; i < 30 ; i++) tab[i] = (tab[i-1]+1) * 2 ; w. 阅读全文
posted @ 2012-01-06 14:21 Seraph2012 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 2011-12-12 05:15:07地址:http://acm.hdu.edu.cn/showproblem.php?pid=2026题意:中文题。mark:小写转大写可以&0xDF来转。代码:# include <stdio.h>char str[110] ;int main (){ int i ; while (gets(str)) { for (i = 0 ; str[i] ; i++) { if (i == 0 || (str[i-1] == ' ' && str[i] != ' ')) ... 阅读全文
posted @ 2012-01-06 14:21 Seraph2012 阅读(165) 评论(0) 推荐(0) 编辑