摘要:
2011-12-17 06:52:15地址:http://acm.hdu.edu.cn/showproblem.php?pid=2024题意:中文。经典c问题。代码:# include <stdio.h>char str[1010] ;int test (char s[]){ int i ; if (s[0] >= '0' && s[0] <= '9') return 0 ; for (i = 0 ; s[i] ; i++) { if (s[i] == '_') continue ; if (s[i] &g 阅读全文
摘要:
2011-12-17 06:48:26地址:http://acm.hdu.edu.cn/showproblem.php?pid=1996题意:中文。mark:每个数字都可能出现在3根柱子上。所以是3^n。代码:# include <stdio.h>long long dp[35] = {1} ;int main (){ int i, n ; for (i = 1 ; i <= 30 ; i++) dp[i] = dp[i-1] * 3 ; scanf ("%d", &n) ; while (~scanf ("%d", & 阅读全文
摘要:
2011-12-17 06:44:26地址:http://acm.hdu.edu.cn/showproblem.php?pid=1995题意:中文。mark:其实越小的盘子移动次数越多。每个盘子是以前的盘子的2倍。1、2、4、8……代码:# include <stdio.h>int main (){ int T, n, num ; scanf ("%d", &T) ; while (T--) { scanf ("%d%d", &n, &num) ; printf ("%I64d\n", 1LL &l 阅读全文
摘要:
2011-12-17 06:39:22地址:http://acm.hdu.edu.cn/showproblem.php?pid=1259题意:中文。水题,直接模拟。代码:# include <stdio.h>int main (){ int i, T, m, a, b, t ; int tab[10] ; scanf ("%d", &T) ; while (T--) { scanf ("%d", &m) ; for (i = 1 ; i<= 7 ; i++) tab[i] = i ; while (... 阅读全文
摘要:
2011-12-17 06:38:31地址:http://acm.hdu.edu.cn/showproblem.php?pid=1977题意:输出第n行右边的两个数。mark:其实就是立方。要用long long,其实n达不到2100000,不然都该溢出了。代码:# include <stdio.h>int main (){ int T ; long long n ; scanf ("%d", &T) ; while (T--) { scanf ("%I64d", &n) ; printf ("%I64d %I64d 阅读全文
摘要:
2011-12-17 06:28:58地址:http://acm.hdu.edu.cn/showproblem.php?pid=1976题意:中文。代码:# include <stdio.h>int cmp(int a[3], int b[3]){ if (a[0] != b[0]) return a[0] < b[0] ; if (a[1] != b[1]) return a[1] < b[1] ; if (a[2] != b[2]) return a[2] < b[2] ; return 2 ;}int main (){ char rst[3][10] = { 阅读全文
摘要:
2011-12-17 06:22:49地址:http://acm.hdu.edu.cn/showproblem.php?pid=1982题意:#表示空格 -无意义 数字对应'A'-'Z'。字符串处理。代码:# include <stdio.h># include <string.h>char str[10010] ;void output (char str[]){ int i, flag = 0, num ; for (i = 0 ; str[i] ; i++) { if (flag == 0) { if (str[i] >... 阅读全文
摘要:
2011-12-17 06:13:33地址:http://acm.hdu.edu.cn/showproblem.php?pid=1985题意:单位换算。mark:打表非常方便。代码:# include <stdio.h># include <string.h>char tab[4][5] = {"kg", "lb", "l", "g"} ;char outtab[4][5] = {"lb", "kg", "g", "l&q 阅读全文
摘要:
2011-12-17 06:05:08地址:http://acm.hdu.edu.cn/showproblem.php?pid=1984题意:删除字符串中的第n个字符。mark:利用字符串拼接。代码:# include <stdio.h>char str[100] ;int main (){ int T, n, nCase = 1 ; scanf ("%d%*c", &T) ; while (T--) { scanf ("%d %s%*c", &n, str) ; str[n-1] = '\0' ; print 阅读全文
摘要:
2011-12-17 05:51:13地址:http://acm.hdu.edu.cn/showproblem.php?pid=1998题意:中文。代码:# include <stdio.h># include <string.h>int dp[25][25] ;void generate(int n){ int i, x = 0, y = n/2, xx, yy ; memset(dp, 0, sizeof(dp)) ; for (i = 1 ; i <= n*n ; i++) { dp[x][y] = i ; xx = (x-1 + n)... 阅读全文