
贪心
文章平均质量分 66
talak
这个作者很懒,什么都没留下…
展开
-
hdu 寒冰王座
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1248一开始是知道是完全背包问题的,但是不会完全背包,也不能叫全不会,只是理解了一点,还差一点就会了刚开始写的时候按照f[i][j]=max(f[i-1][j],f[i-1][j-k*weight[i]]+k*weight[i]);到后来才知道是直接求里面最大的f[i][j]=max(f[i-1原创 2012-05-25 23:32:35 · 1042 阅读 · 0 评论 -
hdu 4268
贪心+数据结构看了题解,研究了一下set,按着题解思路打了一遍#include #include #include #include #include #include #include #include #include using namespace std;struct node{ int height; int width;}alice[10原创 2012-09-10 23:37:18 · 417 阅读 · 0 评论 -
codeforces 241 A
http://codeforces.com/contest/241/problem/A这题感觉很经典 就写了一下这题贪心,每次如果不能到达某个地方,就一直最后在前面的城市中选油田供给最多的去加油,我也这么想过,但不知道怎么实现,应该收很麻烦看了大神的代码后豁然开朗,其实就用一个变量记录到这个方面前面最多油田的供给量,然后每次不能到时候去加这个就行了代码:#include #i原创 2012-11-02 12:37:54 · 419 阅读 · 0 评论 -
hdu 1789 Doing Homework again
http://acm.hdu.edu.cn/showproblem.php?pid=1789这题贪心 每次找分数最多的看能不能全部完成 不能的话就舍去 去找下一个这个我还真没想到 看题解才知道 这题隐蔽性真大 还有就是判断能不能全部完成那里 我卡主了 蛋疼代码:#include #include #include #include #include #include #原创 2012-11-04 22:52:19 · 337 阅读 · 0 评论