
贪心
lj_acm
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj 1323
贪心基础题。至少能赢多少次。换句话说,就是自己每次出一张牌,其他人尽量让你输,其他人足够聪明,当你出一张牌时,为了让你输,会出一张比你大的,除非其他人没有,那么这轮你就赢啦,为了不造成浪费,最优的方法肯定是出一张比你出的牌大的牌中最小的牌(贪心的思想),可以证明这样的贪心结构是正确的 #include #include #include using namespace std; const原创 2012-11-27 17:29:39 · 763 阅读 · 0 评论 -
poj 1042
//枚举+贪心+优先队列 //最有的方案肯定是从起点走到某个点终止,然后在这条路上通过贪心选择最优的选择(每个点应停留的时间)。最后通过比较得出最优的方案 #include #include #include #include using namespace std; const int maxn=26; int t_spent[maxn],eve[maxn][maxn],cost[max原创 2012-12-21 17:13:37 · 548 阅读 · 0 评论 -
poj 1477
贪心+优先队列 #include #include #include #include using namespace std; const int maxn=50; int h[maxn],n; int main() { int tot=0; while(cin>>n&&n) { tot++; int i; priority_queue q1; priority_原创 2012-12-22 09:47:39 · 555 阅读 · 0 评论 -
hdu 4310
贪心,刚做此题时,就意识到了是贪心,但贪心思路一直没找对,wa了n次,在纠结中终于想出正确的思路 #include #include #include using namespace std; struct node { int x,y; }; node f[25]; bool cmp(node a,node b) { return a.y*b.x<b.y*a.x; } int原创 2012-12-23 00:40:16 · 498 阅读 · 0 评论