摘要:
2011-12-20 15:48:40地址:http://acm.hdu.edu.cn/showproblem.php?pid=2368题意:一个矩形的长宽分别为w、l的PIZZA是否能完全放在一个半径为r的桌子上。代码:# include <stdio.h>int main (){ int nCase = 1, l, w, r ; while (~scanf ("%d", &r) && r) { scanf ("%d%d", &w, &l) ; if (w*w+l*l<=4*r*r) print 阅读全文
摘要:
2011-12-20 15:42:45地址:http://acm.hdu.edu.cn/showproblem.php?pid=2147题意:n*m的棋盘,一开始在右上角。每次只能走到左、下 或者左下。判胜败。mark:简单博弈。n、m同时为奇数则败。代码:# include <stdio.h>int main (){ int n, m ; while (~scanf ("%d%d", &n, &m)) { if (n == 0 && m == 0) break ; if (n&1 && m&1) 阅读全文
摘要:
2011-12-20 15:33:41地址:http://acm.hdu.edu.cn/showproblem.php?pid=2212题意:找所有int范围内的数n满足他的各位数的阶乘和等于本身。mark:打表,只有4个。1、2、145、40585。代码:# include <stdio.h>int main (){ puts ("1\n2\n145\n40585") ; return 0 ;} 阅读全文
摘要:
2011-12-20 15:23:47地址:http://acm.hdu.edu.cn/showproblem.php?pid=1407题意:中文。mark:TLE了几次,没想清楚循环上界。代码:# include <stdio.h># include <math.h>void gao(int num){ int x, y, z ; int lim1 = sqrt(num),lim2 ; for (x = 1 ; x <= lim1+1 ; x++) { lim2 = sqrt(num-x*x) ; for (y = x ; y <= lim... 阅读全文
摘要:
2011-12-20 14:46:51地址:http://acm.hdu.edu.cn/showproblem.php?pid=1412题意:中文。代码:# include <stdio.h># include <stdlib.h>int a[10010], b[10010], c[20010] ;int cmp(const void *a, const void *b){ return *(int*)a - *(int*)b ;}int main (){ int n, m, cnt, i, j ; while (~scanf ("%d%d", &a 阅读全文
摘要:
2011-12-20 15:08:24地址:http://acm.hdu.edu.cn/showproblem.php?pid=1337题意:和2053一样。代码:# include <stdio.h>int main (){ int T, n, i, ans ; int tab[] = {1,4,9,16,25,36,49,64,81,100} ; scanf ("%d", &T) ; while (T--) { scanf ("%d", &n) ; ans = 0 ; for (i = 0 ; i < 10 ; i+ 阅读全文
摘要:
2011-12-20 14:08:27地址:http://acm.hdu.edu.cn/showproblem.php?pid=1017题意:给n和m,求满足0 < a < b < n 且(a^2+b^2 +m)/(ab)是整数的(a,b)有多少对。mark:格式比较蛋疼。代码:# include <stdio.h>int calc(int n, int m){ int i, j, rtn = 0 ; for (i = 1 ; i < n ; i++) for (j = i+1 ; j < n ; j++) if ((i*i+j*j+m) % (... 阅读全文
摘要:
2011-12-20 13:33:58地址:http://acm.hdu.edu.cn/showproblem.php?pid=1249题意:中文。mark:前面假设有n-1个三角形,考虑一个新三角形每个边切已有边交点为2(n-1),新增小面为3*(2(n-1)-1),再加新增三个角,共新增小面6(n-1)块。所以dp[n] = dp[n-1]+6(n-1)。解得dp[n] = 3*n^2-3n+2。代码:# include <stdio.h>int main(){ int T, n ; scanf ("%d", &T) ; while (T--) { 阅读全文
摘要:
2011-12-20 13:17:01地址:http://acm.hdu.edu.cn/showproblem.php?pid=1014题意:其实就是求两个数是否互素。是则为Good,否则为Bad。PE了2次。每组后面都有空行,数字10列,和字母之间是4个空格(开始写成5个)。代码:# include <stdio.h>int gcd(int a, int b){return a%b?gcd(b,a%b):b;}int main (){ char tab[2][15] = {"Bad Choice", "Good Choice"} ; int 阅读全文
摘要:
2011-12-20 13:07:58地址:http://acm.hdu.edu.cn/showproblem.php?pid=1070题意:故事的主角喝牛奶每天喝200ml,不到200ml的牛奶直接扔掉。一罐牛奶最多只喝5天,超过5天扔掉。给n个牌子的牛奶价格和体积,问哪个最便宜。。。mark:wa了n次,没看到题目的一句话:If there are more than one cheapest brand, you should output the one which has the largest volume.另外有两个牌子都大于1000ml的情况,我一开始直接把大于1000的vol 阅读全文