# UVa-11729 - Commando War:简单题

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LOCAL
using namespace std;
#define maxn 1000+5
struct node{
int b,j;
};
node Nod[maxn];
int cmp(node a,node b){
return a.j>b.j;
}
int main()
{
#ifdef LOCAL
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif
int N,Case=0;
while(scanf("%d",&N)==1&&N){

printf("Case %d: ",++Case);
for(int i=0;i<N;i++) {
scanf("%d%d",&Nod[i].b,&Nod[i].j);
}
sort(Nod,Nod+N,cmp);
int ans=0,time=0;
for(int i=0;i<N;i++){
ans=max(ans,time+Nod[i].b+Nod[i].j);
time+=Nod[i].b;
}
printf("%d\n",ans);
}
return 0;
}

• 本文已收录于以下专栏：

## Commando War Uva 11729

• 2013-08-30 20:35
• 700B
• 下载

## UVA 11729-Commando War（排序分任务）

Commando War “Waiting for orders we held in the wood, word from the front never came By evening ...

## uva 11729 Commando War（贪心算法）

uva 11729 Commando War G Commando War Input: Standard Input Output: Standard O...

## Commando War ,UVa 11729

【题目】 There is a war and it doesn’t look very promising for your country. Now it’s time to act. You ...

## UVa 11729 Commando War (贪心)

11729 - Commando War Time limit: 1.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlin...

## 贪心-突击战（Commando War, UVa 11729）

举报原因： 您举报文章：深度学习：神经网络中的前向传播和反向传播算法推导 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)