摘要:
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
阅读(144)
评论(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
阅读(138)
评论(0)
推荐(0)
摘要:
2011-12-20 03:41:50地址:http://acm.hdu.edu.cn/showproblem.php?pid=2393题意:输入三角形三边长,判断是否是直角三角形。mark:勾股定理,最大边40000,运算中间数最大是3.2*10^9,比int的上界2.2*10^10小,因此不用担心溢出。代码:# include <stdio.h>int main (){ int T, a, b, c ; int nCase = 1 ; scanf ("%d", &T) ; while (T--) { scanf ("%d%d%d" 阅读全文
posted @ 2012-01-06 22:39
Seraph2012
阅读(220)
评论(0)
推荐(0)
摘要:
2011-12-20 03:35:04地址:http://acm.hdu.edu.cn/showproblem.php?pid=2088题意:有n堆砖头,分别有a[i]块砖。问至少要移动多少块,能让他们全都一样高。mark:先求平均高度,然后逐个求差后,除以2。代码:# include <stdio.h>int a[60] ;int abs(int n){return n<0?-n:n;}int main (){ int n, i, sum, ans, nCase = 1 ; while (~scanf ("%d", &n) && 阅读全文
posted @ 2012-01-06 22:39
Seraph2012
阅读(144)
评论(0)
推荐(0)
摘要:
2011-12-20 03:27:09地址:http://acm.hdu.edu.cn/showproblem.php?pid=2087题意:中文。直接枚举。代码:# include <stdio.h># include <string.h>char s1[1010], s2[1010] ;int find(char *s1, char *s2){ int i ; for (i = 0 ; s2[i] ; i++) if (s1[i] != s2[i]) return 0 ; return 1 ;}int main (){ int i, len1, len... 阅读全文
posted @ 2012-01-06 22:38
Seraph2012
阅读(137)
评论(0)
推荐(0)
摘要:
2011-12-20 03:18:52地址:http://acm.hdu.edu.cn/showproblem.php?pid=2058题意:找[a,b]连续和为m的数串。枚举a或者枚举b都是会超时的,只能枚举a到b的项数。因为这个数字的范围是1到sqrt(8b)左右,因此不会TLE。TLE了2次,都是2b错误。第一次直接枚举a,第二次忘了考虑a了,直接枚举了所有的情况- -。代码:# include <stdio.h># include <math.h>void output (long long a, long long b){ long long n, p ; f 阅读全文
posted @ 2012-01-06 22:36
Seraph2012
阅读(141)
评论(0)
推荐(0)
摘要:
2011-12-20 02:48:53地址:http://acm.hdu.edu.cn/showproblem.php?pid=2043题意:中文。代码:# include <stdio.h>char str[60] ;int test (char str[]){ int i, flag[4] = {0,0,0,0} ; for (i = 0 ; str[i] ; i++) { if (str[i] >= 'A' && str[i] <= 'Z') flag[0] = 1 ; else if (str[i] >= & 阅读全文
posted @ 2012-01-06 22:35
Seraph2012
阅读(153)
评论(0)
推荐(0)
摘要:
2011-12-20 02:53:00地址:http://acm.hdu.edu.cn/showproblem.php?pid=2057题意:十六进制a+b~代码:# include <stdio.h>int main (){ long long a, b, c ; while (~scanf ("%I64X%I64X", &a, &b)) { c = a+b ; if (c < 0){putchar ('-') ; c = -c ;} printf ("%I64X\n", c) ; } return 0 阅读全文
posted @ 2012-01-06 22:35
Seraph2012
阅读(150)
评论(0)
推荐(0)
摘要:
2011-12-20 02:42:35地址:http://acm.hdu.edu.cn/showproblem.php?pid=1085题意:面额为1、2、5的硬币各有a、b、c枚。问最小的不能由它们组成的面额。mark:不要想复杂了。对于一个给定的面额n,可以用O(1)的贪心办法判断它是否能由题目所给条件的硬币组成。然后从头搜到尾。代码:# include <stdio.h>int a, b, c ;int min(int a, int b){return a<b?a:b;}int test(int n){ n -= 5*min(n/5, c) ; n -= 2*min(n 阅读全文
posted @ 2012-01-06 22:30
Seraph2012
阅读(179)
评论(0)
推荐(0)
摘要:
2011-12-19 17:24:45地址:http://acm.hdu.edu.cn/showproblem.php?pid=1234题意:每天有n个人签到和离开,问最早到的和最后离开的人的名字。水。代码:# include <stdio.h># include <string.h>typedef struct tm{ int h, m, s ;}tm ;int isless(tm t1, tm t2){ if (t1.h != t2.h) return t1.h < t2.h ; if (t1.m != t2.m) return t1.m < t2.m 阅读全文
posted @ 2012-01-06 22:26
Seraph2012
阅读(170)
评论(0)
推荐(0)

浙公网安备 33010602011771号