摘要:
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
阅读(151)
评论(0)
推荐(0)
摘要:
2011-12-16 04:59:45地址:http://acm.hdu.edu.cn/showproblem.php?pid=2027题意:中文。代码:# include <stdio.h># include <string.h>char str[110] ;int main (){ int i, T, nCase = 1 ; char tabstr[] = "aeiou" ; int tab[300] ; scanf ("%d%*c", &T) ; while (T--) { gets(str) ; memset (t 阅读全文
posted @ 2012-01-06 17:07
Seraph2012
阅读(183)
评论(0)
推荐(0)
摘要:
2011-12-16 04:54:26地址:http://acm.hdu.edu.cn/showproblem.php?pid=2098题意:中文,水。直接爆。代码:# include <stdio.h># include <math.h>int IsPrime(int n){ int i, lim = (int)sqrt(n)+1 ; if (n == 2 || n == 3) return 1 ; for (i = 2 ; i <= lim ; i++) if (n % i == 0) return 0 ; return 1 ;}int calc(in... 阅读全文
posted @ 2012-01-06 17:06
Seraph2012
阅读(161)
评论(0)
推荐(0)
摘要:
2011-12-16 04:45:58地址:http://acm.hdu.edu.cn/showproblem.php?pid=2028题意:中文。代码:# include <stdio.h>int gcd(int a, int b){return a%b?gcd(b,a%b):b;}int lcm(int a, int b){return a/gcd(a,b)*b;}int main (){ int n, num, ans ; while (~scanf ("%d", &n)) { ans = 1 ; while (n--) { ... 阅读全文
posted @ 2012-01-06 17:04
Seraph2012
阅读(200)
评论(0)
推荐(0)
摘要:
2011-12-16 04:48:40地址:http://acm.hdu.edu.cn/showproblem.php?pid=2503题意:中文。水。代码:# include <stdio.h>int gcd(int a, int b){return a%b?gcd(b,a%b):b;}int main (){ int T ; int a, b, c, d, e, f, g ; scanf ("%d", &T) ; while (T--) { scanf ("%d%d%d%d", &a, &b, &c, &a 阅读全文
posted @ 2012-01-06 17:04
Seraph2012
阅读(185)
评论(0)
推荐(0)
摘要:
2011-12-16 04:39:01地址:http://acm.hdu.edu.cn/showproblem.php?pid=2084题意:中文~经典dp。代码:# include <stdio.h>int dp[110][110] ;int max(int a, int b){return a>b?a:b;}int main (){ int T, n, i, j ; scanf ("%d", &T) ; while (T--) { scanf ("%d", &n) ; for (i = 1 ; i <= n ; 阅读全文
posted @ 2012-01-06 17:01
Seraph2012
阅读(135)
评论(0)
推荐(0)
摘要:
2011-12-16 04:43:08地址:http://acm.hdu.edu.cn/showproblem.php?pid=2025题意:中文。mark:wa了一次。pos = 0写成了pos = 1。代码:# include <stdio.h>char str[110] ;int main (){ int i, pos ; while (gets(str)) { pos = 0 ; for(i = 1 ; str[i] ; i++) if (str[i] > str[pos]) pos = i ; for ... 阅读全文
posted @ 2012-01-06 17:01
Seraph2012
阅读(175)
评论(0)
推荐(0)
摘要:
2011-12-16 04:34:56地址:http://acm.hdu.edu.cn/showproblem.php?pid=2161题意:判断是不是素数。在这题中2不算素数。mark:数据较小,直接暴。wa了一次,没注意结束条件是n<=0而不是n==0。代码:# include <stdio.h>int test(int n){ int i ; if (n <=2) return 0 ; for (i = 2 ; i < n ; i++) if (n%i == 0) return 0 ; return 1 ;}int main (){ int n... 阅读全文
posted @ 2012-01-06 16:59
Seraph2012
阅读(188)
评论(0)
推荐(0)
摘要:
2011-12-16 04:29:08地址:http://acm.hdu.edu.cn/showproblem.php?pid=2113题意:中文。代码:# include <stdio.h>int calc(int n){ int sum = 0 ; while(n) { if ((n&1) == 0) sum += (n%10) ; n/=10 ; } return sum ;}int main (){ int n , flag = 0 ; while (~scanf ("%d", &n)) ... 阅读全文
posted @ 2012-01-06 16:58
Seraph2012
阅读(192)
评论(0)
推荐(0)
摘要:
2011-12-16 04:24:00地址:http://acm.hdu.edu.cn/showproblem.php?pid=2154题意:中文。mark:简单递推。dp[i] = dp[i-1]+dp[i-2]*2。注意取mod。代码:# include <stdio.h>int dp[1010] = {1, 0} ;int main (){ int i ; for (i = 2 ; i<= 1000 ; i++) dp[i] = (dp[i-1] + dp[i-2]*2) % 10000 ; while (~scanf ("%d", &i) 阅读全文
posted @ 2012-01-06 16:57
Seraph2012
阅读(126)
评论(0)
推荐(0)

浙公网安备 33010602011771号