上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 51 下一页
摘要: 2011-12-17 06:00:46地址:http://acm.hdu.edu.cn/showproblem.php?pid=1994题意:中文。mark:阅读题,各种绕。公式:y*(1+e/100*q/365)*(1+g/100),y*(1+f/100*(q+365)/365)。代码:# include <stdio.h>int main (){ int T ; double y, q, e, f, g ; scanf ("%d", &T) ; while (T--) { scanf ("%lf%lf%lf%lf%lf", &am 阅读全文
posted @ 2012-01-06 18:45 Seraph2012 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 2011-12-17 04:11:34地址:http://acm.hdu.edu.cn/showproblem.php?pid=1052题意:田忌赛马,给n个马匹的速度,胜+200,负-200,平的话什么都不做。问最多得多少钱。mark:写了一个二分图匹配,但是发现有平的情况真是非常不好处理,应该需要最佳匹配才能解决。这里直接用贪心的结论了。代码:# include <stdio.h># include <stdlib.h>int a[1010], b[1010] ;int n ;int gao(){ int i ; int p1=0,p2=0,q1=n-1,q2=n- 阅读全文
posted @ 2012-01-06 18:44 Seraph2012 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 2011-12-17 01:37:11地址:http://acm.hdu.edu.cn/showproblem.php?pid=2054题意:输入2个数字,问你是否相等(大数)。mark:RE1次,数组要开到10w。。。蛋疼。这题其实简单,依次做三件事:加小数点(若无小数点),去末尾0,去前导0。没有负数的情况。代码:# include <stdio.h># include <string.h>char s1[100010], s2[100010] ;void AddDecimal (char *s){ int i ; for (i = 0 ; s[i] ; i++) 阅读全文
posted @ 2012-01-06 18:43 Seraph2012 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 2011-12-17 01:26:33地址:http://acm.hdu.edu.cn/showproblem.php?pid=1106题意:中文。字符串处理,总觉得写的不完满。代码:# include <stdio.h># include <stdlib.h># include <string.h>char str[1010] ;int a[1010] ;int cmp(const void *a, const void *b){ return *(int*)a - *(int*)b ;}int main (){ int cnt = 0, flag = 0 阅读全文
posted @ 2012-01-06 17:45 Seraph2012 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 2011-12-17 00:08:43地址:http://acm.hdu.edu.cn/showproblem.php?pid=1207题意:中文,不说。mark:n最大到64。dp方程很容易出,但是64的时候不好处理。用double打表知64的答案是18433,特判一下。代码:# include <stdio.h>long long dp[70] = {0, 1, 3, 5} ;long long min(long long a, long long b){return a<b?a:b;}int main (){ int i, j, n ; dp[64] = 18433 ; 阅读全文
posted @ 2012-01-06 17:44 Seraph2012 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 23:10:35地址:http://acm.hdu.edu.cn/showproblem.php?pid=2037题意:中文,不解释。mark:贪心,按结束时间排序。代码:# include <stdio.h># include <stdlib.h>typedef struct node{ int s, t ;}node ;node a[110] ;int cmp(const void*a, const void *b){ node *p = (node*)a, *q = (node*)b ; if (p->t != q->t) ret 阅读全文
posted @ 2012-01-06 17:43 Seraph2012 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 23:24:42地址:http://acm.hdu.edu.cn/showproblem.php?pid=2077题意:中文。mark:递推。dp[i][0]表示i个盘子从两边杆移到两边杆的次数,dp[i][1]表示i个盘子从两边杆移到中间杆的次数。有dp[i][0] = 3*dp[i-1][0] + 2,dp[i][1] = dp[i-1][0]+dp[i-1][1]+1。然后答案应该是dp[n-1][1]*2+2。数据大约是3^20,没超过int。代码:# include <stdio.h>int dp[25][2] = {0, 0, 2, 1} ;int 阅读全文
posted @ 2012-01-06 17:43 Seraph2012 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 22:36:47地址:http://acm.hdu.edu.cn/showproblem.php?pid=2187题意:中文,不说了。mark:1wa,莫名其妙地多拍了一个return0在循环里,2B了。代码:# include <stdio.h># include <stdlib.h>typedef struct node{ int p, m ;}node ;node a[1010] ;int cmp(const void *a, const void *b){ node* p = (node*)a, *q = (node*)b ; return 阅读全文
posted @ 2012-01-06 17:42 Seraph2012 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 23:03:04地址:http://acm.hdu.edu.cn/showproblem.php?pid=1050题意:一个过道,旁边有如图所示分布的办公室。有n张桌子,分别要从s[i]搬到t[i],每张桌子要搬10min,同一段过道内同一个时间只能有一张桌子存在。问最少需要的分钟数。mark:其实就是最大重叠数。wa了一次,注意同一个点出来的两张桌子,如果一个往左,一个往右,不可以同时进行。代码:# include <stdio.h># include <stdlib.h>typedef struct node{ int a, b ;}node 阅读全文
posted @ 2012-01-06 17:42 Seraph2012 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 14:17:21地址:http://acm.hdu.edu.cn/showproblem.php?pid=1009题意:老鼠拿了m克猫食换豆子。n个屋子,每个屋子有豆子j,猫食f。可以只换一部分。问最多能得到多少豆子。mark:简单贪心。代码:# include <stdio.h># include <stdlib.h>typedef struct node{ int j, f ;}node ;node a[1010] ;int cmp(const void *pp, const void *qq){ node *p = (node*)pp, *q 阅读全文
posted @ 2012-01-06 17:41 Seraph2012 阅读(152) 评论(0) 推荐(0) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 51 下一页