Commando War
来源:互联网 发布:弱电网络进度计划表 编辑:程序博客网 时间:2024/06/06 12:41
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
#define max 10000
struct A
{int b;int j;};
bool cmp(struct A i,struct A j)
{
return i.j>j.j;//
}
int main(int argc, char const *argv[])
{
int i;
int n=0;
struct A a[max];
while(scanf("%d",&i)==1 && i)
{
int ti =0;
for(int j=0;j<i;j++)
scanf("%d%d",&a[j].b,&a[j].j);
sort(a,a+i,cmp);//
int t=0;
for(int j=0;j<i;j++)
{
ti=(a[j].b+a[j].j+t)>ti ? (a[j].b+a[j].j+t): ti;
t+=a[j].b;
}
n++;
cout<<"Case "<<n<<": "<<ti<<endl;
}
return 0;
}
#include <algorithm>
#include <stdio.h>
using namespace std;
#define max 10000
struct A
{int b;int j;};
bool cmp(struct A i,struct A j)
{
return i.j>j.j;//
}
int main(int argc, char const *argv[])
{
int i;
int n=0;
struct A a[max];
while(scanf("%d",&i)==1 && i)
{
int ti =0;
for(int j=0;j<i;j++)
scanf("%d%d",&a[j].b,&a[j].j);
sort(a,a+i,cmp);//
int t=0;
for(int j=0;j<i;j++)
{
ti=(a[j].b+a[j].j+t)>ti ? (a[j].b+a[j].j+t): ti;
t+=a[j].b;
}
n++;
cout<<"Case "<<n<<": "<<ti<<endl;
}
return 0;
}
0 0
- Commando War
- Commando War
- Commando War
- Commando War
- Commando War
- Commando War
- Commando War
- Commando War
- uva --11729-- Commando War
- UVa 11729 Commando War
- uva - 11729 - Commando War
- UVA 11729 - Commando War
- UVA11729--Commando War
- uva 11729 - Commando War
- Uva-11729-Commando War
- UVA 11729 - Commando War
- UVA 11729 Commando War
- Commando War(突击战)
- Erlang inline编译
- C语言的本质(19)——预处理之一:宏定义
- java RSA加密解密
- 二叉平衡树AVL插入删除操作的实现
- Contestants Division - POJ 3140 树形dp
- Commando War
- A - Sum(1.5.1)
- MRC下安全的Block
- Eclipse中从SVN检出项目时遇见的一些问题记录
- 并查集(Union-Find)算法介绍
- Linux中设置服务自启动的三种方式
- scala
- spring tool suite 新建maven项目报错问题
- uva507 - Jill Rides Again(最长连续和)