![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
acblacktea
永不放弃
展开
-
hdu1051
刚学完贪心好渣。。。第一发贪心#include<stdio.h>#include<math.h>#include <algorithm>using namespace std; struct stick{ int w; int l;}a[5005];int cmp(const stick &a,const stick &b){ if(a.l==b.l)原创 2015-07-28 17:10:55 · 405 阅读 · 0 评论 -
codeforces 353 div2 Tree Construction
将搜索二叉树逆时针旋转45度会发现这是n条值递增的链且头元素相连 如示例/*84 2 3 1 6 10 9 8 第一条链 4 - 6———————————————————————————10 | | |原创 2016-05-19 22:51:27 · 401 阅读 · 0 评论 -
poj 1456 Supermarket 贪心 并查集优化
按价值排序后由大到小加进结果,贪心的放在最后的时间里如果某个时间已经占满往前放这时要用并查集维护这天前面没有占满的最后一天#include<cstdio>#include<algorithm>#include<cstring>#include<cstdlib>#include<queue>#define maxn 10015using namespace std;int n;stru原创 2016-07-25 22:12:07 · 286 阅读 · 0 评论 -
codeforces Recover the String
题目很好推 00的个数推0的个数 11的个数推1的个数 如果存在那么就判断四个数的合是否为 C(0和1的总个数,2)如果存在有解贪心一下就行即根据第二个数值和1的位置固定然后叉进0最后使其成立 有个超级坑的就是00或11的个数 是0时那0或1的个数是0 或者是1要特殊判断!!!!#include<cstdio>#include<cstring>#include<algorithm>#incl原创 2016-09-05 22:41:43 · 452 阅读 · 0 评论