
贪心
mig_davidli
稍微明白点算法和C++,参加过几个小项目。。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【贪心】UVALive 6530——Football
Your favorite football team is playing a charity tournament, which is part of a worldwide fundraisinge ort to help children with disabilities. As in a normal tournament, three points are awarded to原创 2014-05-04 23:26:33 · 1560 阅读 · 0 评论 -
【继续找状态做简单题】HDU 1052 Tian Ji -- The Horse Racing
继续找状态,慢慢恢复:点击打开链接策略证明如下(声明:PPT为转载):#include #include #include using namespace std;int tian[1001];int qi[1001];bool cmp(int a,int b){ return a>b;}int main(){ int hors原创 2014-02-09 15:16:43 · 1260 阅读 · 0 评论 -
【set+贪心】HDU 4268——Alice and Bob
来源:点击打开链接去年网络赛第一场的第二个题。当时也想到了用贪心,可是超时了,现在复习了起来,发现可以用mutliset,先把alice和bob出的卡片按长度排序,再把所有剩下的矩形队进行贪心,贪当前alice与bob差距最小的矩形队。用到了upper_bound()参数。#include #include #include #include #include using n原创 2013-08-12 10:04:08 · 1057 阅读 · 0 评论 -
【重新开工】SDUT 2074——区间覆盖问题
题目:点击打开链接一个多月没写代码了,手生的1B,KMP都看不懂了 TAT 多校练习赛该怎么不被碾碎呢。。。。。。。做些贪心题找找手感,这就是一个典型的问题,区间覆盖。覆盖的线段数要尽可能的截,优先截取的一定是差值大的,这样才能保证最短的线段覆盖长度。别忘了线段差-1。。#include #include #include using namespace std;in原创 2013-07-22 19:41:26 · 1520 阅读 · 0 评论 -
【想一想发现是贪心】HDU3730-Chain
水题联赛唯一做出的一道题问题描述Li Lei has many pearls of N different color. The number of each color is limited. Han Mei is Li Lei’s girl friend.Since Han Mei’s birthday is coming, Li Lei wants to give Han Mei h原创 2012-12-17 09:44:02 · 946 阅读 · 0 评论 -
【巧妙的贪心条件】HDU 3177—— Crixalis's Equipment
题目:点击打开题目链接巧妙的贪心。这个问题讲了一个沙王(就是DOTA里面的那货)要搬家,他有一个V大小的洞,M件装备,每件装备有两个属性,Ai是永久占用的空间,搬过来就占了,Bi是临时占用空间,除了满足洞>=Ai外,还要满足搬这件装备时,洞里的大小大于等于Bi。问能否搬完。贪心的形式已经很熟了,但这个题的贪心排序开始排序的时候,是按Ai>Bi来排序的,结果WA。想了想,Bi事实上是在搬原创 2013-01-30 14:32:20 · 1616 阅读 · 0 评论