2011年4月24日

hdu 1050

摘要: 这题思路百度的,自己的思路太差了,不行,百度到的思路非常巧妙,哪一段重合的次数最大就是要移动的时间*10...orz神牛们..View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 int main( ) 5 { 6 int N; 7 scanf("%d",&N); 8 while(N--) 9 {10 int M,a,b,i,j,c[210],temp;11 memset(c,0,sizeof(c));12 scanf("%d& 阅读全文

posted @ 2011-04-24 23:33 more think, more gains 阅读(231) 评论(0) 推荐(0) 编辑

wooden sticks

摘要: 这道题的思路是对木棍的长度排序,如果相同再按重量排序,从小到大。这题不知道为什么,我用qsort排序是wrong answer ..一用sort排序时,就AC啦。。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 using namespace std; 6 struct node 7 { 8 int l; 9 int w;10 }T[5010];11 bool cmp(node a,node b)12 { 阅读全文

posted @ 2011-04-24 22:41 more think, more gains 阅读(197) 评论(0) 推荐(0) 编辑

今年暑假不AC

摘要: 刚开始的时侯,自己以为最优的解法,先按开始时间排序,如果相同再按照,结束时间排序,然后根据时间差得结果,可是一直wrong answer,百度了下别人的思路,才知道最优的解法,是按结束时间排序,想想也是.......贪心就是如何找最优解法。。。。。。。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 using namespace std; 6 struct node 7 { 8 int i; 9 int 阅读全文

posted @ 2011-04-24 20:48 more think, more gains 阅读(154) 评论(0) 推荐(0) 编辑

HDU 动态规划(46道题目) ( 转 载 )

摘要: HDU 动态规划(46道题目)倾情奉献~ 【只提供思路与状态转移方程】 收藏 Robberies http://acm.hdu.edu.cn/showproblem.php?pid=2955 背包;第一次做的时候把概率当做背包(放大100000倍化为整数):在此范围内最多能抢多少钱 最脑残的是把总的概率以为是抢N家银行的概率之和… 把状态转移方程写成了f[j]=max{f[j],f[j-q[i].v]+q[i].money}(f[j]表示在概率j之下能抢的大洋); 正确的方程是:f[j]=max(f[j],f[j-q[i].money]*q[i].v) 其中,f[j]表示抢j块大洋的最大的逃脱 阅读全文

posted @ 2011-04-24 01:07 more think, more gains 阅读(320) 评论(0) 推荐(0) 编辑

导航