上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 51 下一页
摘要: 总算水完第350题了。之间过了个元旦,然后打了几天游戏,然后原来的博客被封了,移数据、开新博客又搞了两天。搞得老衲现在没神马手感了,悲了个剧! 阅读全文
posted @ 2012-01-08 05:27 Seraph2012 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1563题意:找n个数里只出现了1次的数。mark:hash搞之。大于200的最小素数是211。代码:# include <stdio.h># include <string.h>int dp[211][2] ;void insert (int n){ int idx = n % 211 ; while (dp[idx][0] != n && dp[idx][1] != 0) idx++ ; dp[idx][0] = n ; dp[idx][1] ++ ;}int 阅读全文
posted @ 2012-01-08 05:25 Seraph2012 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1491题意:给一个2006年的日期,问和2006年10月21日还差几天。mark:getdays是用于获得m月d日是当年的第几天。最后和10月21日做比较。代码:# include <stdio.h>int getdays (int m, int d){ int i, rtn = 0, month [12] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30} ; for (i = 0 ; i < m ; i++) rtn += m... 阅读全文
posted @ 2012-01-08 05:11 Seraph2012 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1253题意:中文。。。mark:三维BFS水过。其实和二维没多大区别。代码:# include <stdio.h># include <string.h># define REP(i,a) for(i = 0 ; i < a ; i++)int q[55*55*55][3] ;int graph[55][55][55] ;int step[55][55][55] ;int a, b, c, t ;int tab[6][3] = {{0, 0, 1}, {0, 0, -1}, 阅读全文
posted @ 2012-01-08 01:09 Seraph2012 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1577题意:中文。mark:gcd是否为1。注意不能有除数为0。代码:# include <stdio.h>int abs(int n){return n<0?-n:n;}int gcd(int a, int b){return a%b==0?b:gcd(b,a%b);}int main (){ int l, px, py, sx, sy ; while (~scanf ("%d", &l), l) { scanf ("%d%d%d%d" 阅读全文
posted @ 2012-01-08 00:11 Seraph2012 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1708题意:给两个字符串s0和s1,sn是sn-1和sn-2拼接而成的。问sn中每个字母出现的次数。mark:直接递推就可以了。注意0的情况。代码:# include <stdio.h># include <stdlib.h># include <string.h>int t1[30], t2[30], t3[30] ;void output (int t[]){ int i ; for (i = 0 ; i < 26 ; i++) printf (" 阅读全文
posted @ 2012-01-07 21:50 Seraph2012 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2309题意:给n个数,去掉一个最大的和一个最小的,然后求平均数。蛋疼的日式英文。代码:# include <stdio.h>int main (){ int n, max_n, min_n, num, sum ; int i ; while (~scanf ("%d", &n), n) { sum = 0 ; min_n = 1100, max_n = -1 ; for (i = 0 ; i < n ; i++) { ... 阅读全文
posted @ 2012-01-07 00:38 Seraph2012 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 2012-01-02 19:55:02地址:http://acm.hdu.edu.cn/showproblem.php?pid=2401题意:有1-N一共N个篮子,每个里面有很多金币。每个金币的重量是w,但是其中有一个篮子金币的重量只有w-d。现在从第一个篮子拿1个金币,第二个拿2个。。。第n-1个篮子拿n-1个。第n个不拿。把拿出来的金币称重。问金币轻的篮子编号是多少。mark:不知道第二组sample为什么可以是10。。。诡异。代码:# include <stdio.h>int main (){ int n, w, d, rst, ans ; while (~scanf (&q 阅读全文
posted @ 2012-01-07 00:37 Seraph2012 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 2012-01-02 17:22:53地址:http://acm.hdu.edu.cn/showproblem.php?pid=2529题意:中文。mark:设v的水平分量为x,则最终距离和x的关系应该是先增后减,遂三分。。。代码:# include <stdio.h># include <math.h>double l, v ;double f(double x){ return sqrt(v*v-x*x)*l/x - 0.5*9.8*l*l/(x*x) ;}int main (){ double left, right, m1, m2, h ; while (~sc 阅读全文
posted @ 2012-01-07 00:36 Seraph2012 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 2012-01-02 04:07:41地址:http://acm.hdu.edu.cn/showproblem.php?pid=2516题意:中文。mark:完全不会。看了网上说打表看出规律似乎是Fibonacci。遂写代码。wa了一次,因为[0...43]的数量我用二分的时候居然算成了43个。。。应该是44个的。代码:# include <stdio.h># include <stdlib.h>int dp[50] = {2, 3} ;int cmp(const void *a, const void *b){ return *(int*)a - *(int*)b ; 阅读全文
posted @ 2012-01-07 00:35 Seraph2012 阅读(129) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 51 下一页