hdu4221 Greedy?(贪心)
来源:互联网 发布:java递归排序问题 编辑:程序博客网 时间:2024/06/06 09:14
真不知道为啥全是英文题。。。就不能好好的出中文的啊 啊 啊
果然看错了题意
#include <stdio.h>#include <algorithm>using namespace std;struct node {long long day,end;}c[100005];bool cmp(node x,node y){if(x.end<y.end) return true;if(x.end==y.end&&x.day>y.day) return true;return false;}int main(){int test,n,q=1;scanf("%d",&test);while(test--){scanf("%d",&n);for(int i=0;i<n;i++)scanf("%lld %lld",&c[i].day,&c[i].end);sort(c,c+n,cmp);long long sum=0,max=0;for(int i=0;i<n;i++){sum+=c[i].day;if(sum-c[i].end>max)max=sum-c[i].end;}printf("Case %d: %lld\n",q++,max);}return 0;}
唉 果然理解错了题意 连样例都看不懂
1 1
- hdu4221 Greedy?(贪心)
- HDU4221(Greedy?)贪心
- hdu4221-Greedy?
- hdu4221 Greedy?
- hdu4221 Greedy
- hdu4221 Greedy?
- hdu4221(贪心)
- hdu4221(贪心)
- 贪心算法(Greedy algorithm)
- 贪心算法(greedy algorithm)
- HDU 4221 Greedy?(贪心)
- HDU 4221 Greedy?(贪心)
- 贪心算法(greedy algorithm)
- 贪心Greedy
- hdu4221
- hdu4221
- 贪心算法(GREEDY ALGORITHM)证明实践
- POJ3069 Saruman's Army Greedy(贪心)
- 将log4net封装在类库中的方法
- CF540E
- leetcode--House Robber
- 如何应对云攻击评估云安全控制是关键
- Jquery仿淘宝购物车
- hdu4221 Greedy?(贪心)
- 队列的数组实现
- 提高matlab运行速度
- org.slf4j.spi.LocationAwareLogger.log
- 关于Hiberate的数据库操作(纯手打)
- matlab程序运算速度
- MongoDB命令操作(入门)
- kendo实现栏目管理页面
- p123第三章作业36题