上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 51 下一页
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1999题意:中文。mark:打表到100w。。。(上限是试出来的。。。)代码:# include <stdio.h>int sum[1000010] ;int dp[1010] ;void init(){ int i, j ; for (i = 1 ; i <= 500000 ; i++) for (j = 2*i ; j <= 1000000 ; j+= i) sum[j] += i ; for (i = 2 ; i <= 1000000 ; i+... 阅读全文
posted @ 2012-01-13 22:28 Seraph2012 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1088题意:写一个html代码显示的程序。。。mark:就是麻烦,没别的。各种PE。后来发现是只考虑了' '和'\n',忘记考虑'\t'。。。代码:# include <stdio.h>int main (){ int ch, cnt = 0, cc = 0 ; int flag = 0, end = 1 ; int i ; char buff[100] ;// freopen ("in.txt", "r" 阅读全文
posted @ 2012-01-13 21:20 Seraph2012 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2068题意:中文。mark:如果知道错排公式就很简单了。wa了一次。。。<=写成了<。。。PE一次。莫名其妙多加了个空格。sb了。代码:# include <stdio.h>long long c[30][30] = {1} ;long long cp[15] = {0, 0, 1} ;void init(){ int i, j ; for (i = 1 ; i <= 25 ; i++) { c[i][0] = 1 ; for (j = 1 ; j <= i... 阅读全文
posted @ 2012-01-13 07:08 Seraph2012 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1420题意:求a^b mod c。mark:快速幂无疑是最简单的写法。不过c只有100w,也可以用数论的方法做。此处用的是快速幂。代码:# include <stdio.h>int mod ;int qpow(long long a, long long b){ long long ans = 1, buff = a ; while (b) { if (b&1) ans = (ans*buff) % mod ; b >>= 1 ; buff =... 阅读全文
posted @ 2012-01-13 06:39 Seraph2012 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1072题意:I想(从2处)逃出迷宫(3处),0是墙,1是空地。身上有定时炸弹,在第6s爆炸(只能走5步)。4处是将定时炸弹重设的工具。问它最快能否逃出迷宫。mark:bfs。多添加一个数组标记上次到达当前位置时定时炸弹的剩余秒数。代码:# include <stdio.h># include <string.h>int n, m ;int graph[10][10] ;int step[10][10] ;int times[10][10] ;int sx, sy, ex, ey 阅读全文
posted @ 2012-01-13 06:34 Seraph2012 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1593题意:中文。mark:1wa。直接往开始的反方向按半径逃不可以。找一个同心圆,让V1的角速度略大V2。在那个圈上0086可以甩对方一个直径后再往岸边划。代码:# include <stdio.h># include <math.h># define Pi acos(-1)int main (){ int R, V1, V2 ; double t1, t2 ; while (~scanf ("%d%d%d", &R, &V1, &V 阅读全文
posted @ 2012-01-13 03:47 Seraph2012 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1231题意:中文。最大连续子川和。经典dp(不知道算不算dp)。代码:# include <stdio.h>int a[10010] ;int n, s, e, max_sum ;void find(){ int i, ss = s, ee = e, sum = max_sum ; for (i = 1 ; i < n ; i++) { if (sum < 0) ss = ee = sum = a[i] ; else { ... 阅读全文
posted @ 2012-01-13 02:46 Seraph2012 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1898题意:S和X比做题。他们的做题顺序是一样的,但并不是做一题交一题。S每A分钟交一次,X每B分钟交一次。问T分钟的时候是谁交的题多。mark:水。假设每分钟做1题,求出两人各自交了多少题后比较。。。代码:# include <stdio.h>int main (){ int T ; int a, b, t, aa, bb ; scanf ("%d", &T) ; while (T--) { scanf ("%d%d%d", &a, 阅读全文
posted @ 2012-01-13 01:50 Seraph2012 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1718题意:问给定学号在所有成绩里的排名。。。mark:无聊题。1wa,多组输入。。。代码:# include <stdio.h>int a[1100], b[1100] ;int main (){ int i, aa, ans, cnt = 0 ; while (~scanf ("%d", &aa)) { cnt = 0 ; while (~scanf ("%d%d", &a[cnt], &b[cnt])) { if (... 阅读全文
posted @ 2012-01-11 22:42 Seraph2012 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1286题意:中文。mark:看似很绕其实就是求欧拉函数Phi(n)。对于所有n的素因子Pi,欧拉函数Phi(n) = n * (P1-1)/P1 * (P2-1)/P2 * (P3-1)/P3 ...。对于每一个Pi,因为n总是Pi的倍数,所以可以先除再乘,不会溢出。代码:# include <stdio.h>int Primes[40000] = {2, 3} ;int PrimeNum = 2 ;int dp[40000] ;int calc(int nn){ int ans = nn, 阅读全文
posted @ 2012-01-11 01:21 Seraph2012 阅读(154) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 51 下一页