上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 51 下一页
摘要: 2011-12-20 12:09:16地址:http://acm.hdu.edu.cn/showproblem.php?pid=2200题意:中文。mark:求公式。假如n个元素就是1~n。设较小的集合内最大的数字为i,则小集合可以有2^(i-1)种取法。较大的集合则有2^(n-1)-1种取法。把i从1到n累加起来,得公式(n-2)*2^(n-1)+1。代码:# include <stdio.h>int main (){ long long n ; while (~scanf ("%I64d", &n)) { printf ("%I64d\n& 阅读全文
posted @ 2012-01-06 23:00 Seraph2012 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 11:29:53地址:http://acm.hdu.edu.cn/showproblem.php?pid=1228题意:中文。代码:# include <stdio.h># include <string.h>int a, b, cnt ;char str[110] ;char words[11][11] ;void getword(){ int i, cc = 0 ; char cur_word[11] ; cnt = 0 ; for (i = 0 ; str[i] ; i++) { if (str[i] == ' '... 阅读全文
posted @ 2012-01-06 22:59 Seraph2012 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 11:11:18地址:http://acm.hdu.edu.cn/showproblem.php?pid=2036题意:中文。mark:求凸多边形面积。计算几何。代码:# include <stdio.h>typedef struct point{ int x, y ;}point ;point a[110] ;double area(point p, point q){ return p.x*q.y - p.y*q.x ;}int main (){ int i, n ; double sum ; while (~scanf ("%d", 阅读全文
posted @ 2012-01-06 22:58 Seraph2012 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 08:41:25地址:http://acm.hdu.edu.cn/showproblem.php?pid=1425题意:中文。mark:PE1次。排序。没有m>n的情况。代码:# include <stdio.h># include <stdlib.h>int a[1000010] ;int cmp(const void *a, const void *b){ return *(int*)b - *(int*)a ;}int main (){ int n, m, i; while (~scanf ("%d%d", & 阅读全文
posted @ 2012-01-06 22:57 Seraph2012 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 08:09:43地址:http://acm.hdu.edu.cn/showproblem.php?pid=2526题意:中文。直接模拟。代码:# include <stdio.h>int dp[1010][210] ;int flag[200], m ;char str[210] ;int get(int a, int b, int c){ return flag[a*100+b*10+c] ;}void output(){ int i, j, len = 0 ; for (i = 0 ; str[i] ;i++) { dp[0][... 阅读全文
posted @ 2012-01-06 22:56 Seraph2012 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 08:35:28地址:http://acm.hdu.edu.cn/showproblem.php?pid=1003题意:找n个数里连续的一串和最大。mark:dp。wa了2次。第一次没考虑负数。第二次少考虑-1 2这种情况。代码:# include <stdio.h>int n, a[100010] ;int spos, epos, max_ans ;int gao(){ int i, s = 0, ans = a[0] ; spos = epos = 0 ; max_ans = a[0] ; for (i = 1 ; i < n ; i++) ... 阅读全文
posted @ 2012-01-06 22:56 Seraph2012 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 07:55:14地址:http://acm.hdu.edu.cn/showproblem.php?pid=1408题意:中文。mark:输入其实是实数。。。题目没说清楚。OLE了一次,wa了好几次,都是精度惹的祸。过了以下测试数据应该就没大问题了。intput10 111 11 0.11.1 0.1output13151315代码:# include <stdio.h>int main (){ double vul, d ; int i, ans ; while (~scanf ("%lf%lf", &vul, &d)) { 阅读全文
posted @ 2012-01-06 22:55 Seraph2012 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 07:12:14地址:http://acm.hdu.edu.cn/showproblem.php?pid=2522题意:中文。。mark:模拟除法运算,注意判循环节,注意负数。代码:# include <stdio.h>int flag[1000010] ;void output(int a, int b){ if (a == 1) return ; if (flag[a]) return ; flag[a] = 1 ; printf ("%d", a/b) ; if (a % b != 0 && a%b != 1) out 阅读全文
posted @ 2012-01-06 22:54 Seraph2012 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 06:54:39地址:http://acm.hdu.edu.cn/showproblem.php?pid=2523题意:中文。mark:运用到桶排序。代码:# include <stdio.h>int x[2010], flag[2010] ;int cnt ;int abs(int n){return n<0?-n:n;}int main (){ int T, n, k, i, j ; scanf ("%d", &T) ; while (T--) { scanf ("%d%d", &n, & 阅读全文
posted @ 2012-01-06 22:52 Seraph2012 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 2011-12-20 06:44:37地址:http://acm.hdu.edu.cn/showproblem.php?pid=2521题意:中文。mark:反素数直接for for暴力求,约莫计算不到10w次。查询可用ST算法,但这题没必要,直接扫就好了。代码:# include <stdio.h>int factor[5010] ;void init(){ int i, j ; for (i = 2 ; i <= 5000 ; i++) { for (j = i ; j <= 5000 ; j+= i) factor[j] ++ ; ... 阅读全文
posted @ 2012-01-06 22:51 Seraph2012 阅读(157) 评论(0) 推荐(0) 编辑
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 51 下一页