uva 11729
来源:互联网 发布:java泛型限制 编辑:程序博客网 时间:2024/06/18 05:31
<pre name="code" class="cpp">#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <string>#include <cstring> #include <vector>#include <set>#include <queue>#include <map>using namespace std;const int MAXN = 1000 + 10;const int MAXM = 1000000000 + 1000;typedef long long LL;/*uva 11729*/ int main(){int N,Case=0;scanf("%d",&N);// N:number of soldierswhile( N!=0 ){++Case;multimap<int,int> m;int B,J;for(int i=0; i<N; i++){cin >> B >> J;m.insert(pair<int,int>(J,B));}multimap<int,int>::reverse_iterator rt = m.rbegin();int total_need = 0, done_need = 0;while( rt != m.rend() ){int first = (*rt).first;int second = (*rt).second;total_need += second;done_need = max(first,done_need-second);rt++;}total_need += done_need;cout << "Case " << Case << ": " << total_need << endl;scanf("%d",&N);}return 0;}
0 0
- uva 11729
- UVa 11729
- uva 11729
- UVA 11729
- uva 11729
- UVA-11729
- uva 11729
- uva 11729
- uva 11729
- UVa 11729
- UVA(11729)
- UVA 11729
- UVa 11729
- UVA 11729
- UVa 11729
- UVA 11292 和 UVA 11729
- Uva 11292 and Uva 11729
- uva --11729-- Commando War
- Smali语法汇总(一)
- HDU 1106
- poll内核源代码剖析
- POJ 2991
- 对象的序列化和反序列化
- uva 11729
- Smali语法汇总(二)
- HDU 3420
- 我教你学C语言(若干分之一)
- android中使用xml里的array资源
- Ubuntu 学习
- epoll内核源代码剖析
- Java实现Http请求参数对特殊字符的处理办法
- 前端开发面试题 (题目列表页)