题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=28436

思路:任务从开始时就不停执行,与其他任务毫无关联,当然是执行时间越长的任务越早执行好了

#include <iostream>
#include <algorithm>
#include <cstdio>
#define RPE(i,n) for(int i=0;i<n;i++)
using namespace std;
const int maxn=1e4+; struct node
{
public:
int x,y;
bool operator < (const node &another) const
{
return y>another.y;
}
}b[maxn]; int main()
{
ios::sync_with_stdio(false);
int n,ca=;
while(cin>>n&&n)
{
RPE(i,n) cin>>b[i].x>>b[i].y;
sort(b,b+n);
int time=;
int Max=-;
RPE(i,n)
{
time+=b[i].x;
Max=max(time+b[i].y,Max);
}
cout<<"Case "<<ca++<<": "<<Max<<endl;
}
return ;
}

最新文章

  1. 栈的C++实现(数组)——创建-push-pop-top-清空栈-处理栈
  2. [Android] 安卓模拟器临时文件相关问题
  3. 给Jquery添加alert,prompt方法,类似系统的Alert,Prompt,可以响应键盘,支持拖动
  4. poj 3083 Children of the Candy Corn (广搜,模拟,简单)
  5. rtems总结
  6. zend framework将zip格式的压缩文件导入并解压到指定文件
  7. 第七章——DMVs和DMFs(1)
  8. asp 301代码
  9. POJ1006-Biorhythms
  10. Js闭包应用场合,为vue的watch加上一个延迟器
  11. Python编程练习:使用 turtle 库完成六边形的绘制
  12. HDU - 1828 Picture
  13. Swift:playground
  14. .net core AOP之Filter
  15. 复杂PC问题——信号量与共享存储区
  16.  RabbitMQ3.6.3集群搭建+HAProxy1.6做负载均衡
  17. Spring Data MongoDB 环境搭建
  18. PSROIAlign的代码实现
  19. TestNG执行测试用例的顺序
  20. 玩lua

热门文章

  1. 【152】C# 操作 Excel 杂记
  2. 使用HttpClient MultipartEntityBuilder 上传文件,并解决中文文件名乱码问题
  3. LVS的持久连接、会话保持和高可用介绍
  4. 搞笑代码注释,佛祖保佑 永无BUG
  5. P3174 [HAOI2009]毛毛虫(树形dp)
  6. 清北考前刷题da5下午好
  7. 什么是GFW
  8. J - Ananagrams(map+vector)
  9. F - System Overload(约瑟夫环变形)
  10. Android 知识Tips