上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 51 下一页
摘要: 2011-12-20 06:30:12地址:http://acm.hdu.edu.cn/showproblem.php?pid=2519题意:中文。其实就是算组合数。mark:即使是long long,算阶乘也只能算到20!,因此用杨辉三角比较简单。代码:# include <stdio.h>int c[31][31] ;void init(){ int i, j ; c[0][0] = 1 ; for (i = 1 ; i <= 30 ; i++) { c[i][0] = 1 ; for (j = 1 ; j <= i ; j++) ... 阅读全文
posted @ 2012-01-06 22:50 Seraph2012 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 06:25:07地址:http://acm.hdu.edu.cn/showproblem.php?pid=1701题意:求一个最小的n,满足n*p%和n%q%中间夹着一个整数。mark:题意真是太诡异了。看了discuss才知道啥意思。最大不会超过10000, 直接搜过。代码。# include <stdio.h>int gcd(int a, int b){return a%b==0?b:gcd(b,a%b) ;}int main (){ int T, i, p, q ; double pp, qq ; scanf ("%d", & 阅读全文
posted @ 2012-01-06 22:49 Seraph2012 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 06:11:14地址:http://acm.hdu.edu.cn/showproblem.php?pid=2537题意:中文,模拟。代码:# include <stdio.h>int gao(int n){ char ch ; int r = 7, y = 7 ; while (n--) { scanf ("%c", &ch) ; if (ch == 'R') r-- ; if (ch == 'Y') y-- ; if (ch == 'B') return r==0 ; if (... 阅读全文
posted @ 2012-01-06 22:48 Seraph2012 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 05:55:00地址:http://acm.hdu.edu.cn/showproblem.php?pid=1868题意:问n可以表示成连续数字和有多少种。mark:和2058如出一辙。TLE了2次,忘记改成long long,算sqrt的时候有个8倍会溢出。代码:# include <stdio.h># include <math.h>typedef long long ll ;ll calc (ll b){ int ans = 0 ; ll n, p ; for (n = ((ll)sqrt(8*b+1)-1) / 2 ; n > 1 ; 阅读全文
posted @ 2012-01-06 22:47 Seraph2012 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 05:34:39地址:http://acm.hdu.edu.cn/showproblem.php?pid=2106题意:n个不同进制的数求和。代码:# include <stdio.h>int base(int a, int b){ if (a == 0) return 0 ; return b * base(a/10, b) + a%10 ;}int main (){ int n, sum, a, b ; while (~scanf ("%d", &n)) { sum = 0 ; while (n--) ... 阅读全文
posted @ 2012-01-06 22:46 Seraph2012 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 05:26:53地址:http://acm.hdu.edu.cn/showproblem.php?pid=1405题意:分解素因子。mark:PE2次。每行最后有一个空格。太无聊了- -。代码:# include <stdio.h>void output(int n){ int i, cnt ; for (i = 2 ; n != 1 ; i++) { if (n%i==0) { cnt = 0 ; while (n%i==0){cnt++; n/=i;} pr... 阅读全文
posted @ 2012-01-06 22:45 Seraph2012 阅读(200) 评论(2) 推荐(1) 编辑
摘要: 2011-12-20 05:17:41地址:http://acm.hdu.edu.cn/showproblem.php?pid=1279题意:中文。没啥好说的。代码:# include <stdio.h>int output (int n){ int flag = 0 ; while (n!=1) { if (n&1) { if (flag == 0) flag = 1 ; else printf (" ") ; printf ("%d", n) ; n = 3... 阅读全文
posted @ 2012-01-06 22:44 Seraph2012 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 05:12:48地址:http://acm.hdu.edu.cn/showproblem.php?pid=2352题意:罗马数字转阿拉伯数字。mark:居然wa了一次。把%d写成了%s,太2了。看似麻烦,其实简单。降序为正,升序为负,遍历即可。代码:# include <stdio.h>char str[110] ;int num[110] ;int n ;int calc(){ int i, j, ans = 0 ; for (i = 0 ; i < n ; i++) { ans += num[i] ; for (j = i... 阅读全文
posted @ 2012-01-06 22:43 Seraph2012 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 04:48:49地址:http://acm.hdu.edu.cn/showproblem.php?pid=2086题意:中文。mark:由Ai= (Ai-1+ Ai+1)/2 - Ci得Ai=2(Ai-1+Ci-1)-Ai-2。用a0、a1和c来表示Ai,递推求得An+1=a0*A0+a1*A1+C。解方程。代码:# include <stdio.h># include <string.h>typedef struct NODE{ double a0, a1 ; double c ;}NODE ;NODE node[3010] ;double c[ 阅读全文
posted @ 2012-01-06 22:42 Seraph2012 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 03:52:39地址:http://acm.hdu.edu.cn/showproblem.php?pid=2391题意:一个地图里,每块区域有数量不等的金子。从左上角开始每次只能向右或向下走,最多能收集到多少块金子。mark:从右下角向左上角dp。代码:# include <stdio.h>int dp[1010][1010] ;int max(int a, int b){return a>b?a:b;}int main (){ int T, n, m, i, j ; int nCase = 1 ; scanf ("%d", & 阅读全文
posted @ 2012-01-06 22:41 Seraph2012 阅读(129) 评论(0) 推荐(0) 编辑
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 51 下一页