# 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）解题报告

2014-07-29 19:02:00

#### UVA-11729 - Commando War（贪心、排序）

2016-07-19 21:00:17

#### 11729 - Commando War（贪心）

2015-09-08 15:37:39

#### 11729 - Commando War

2015-04-28 00:03:15

#### Commando War

2014-02-18 09:07:04

#### Commendo War UVa-11729

2017-07-10 15:50:08

#### Commando War Uva 11729

2013年08月30日 700B 下载

#### 突击战(Commando War,UVA 11792)

2017-10-14 22:08:28

#### UVA 11729 - Commando War

2014-04-21 20:53:17

#### UVa 11729 - Commando War

2014-09-22 21:39:57