当前位置:网站首页>uva11729
uva11729
2022-06-21 12:38:00 【Stabbing the bear with a knife】
#include <iostream>
#include <istream>
#include <sstream>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <iomanip>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iterator>
using namespace std;
struct Node {
int a;
int b;
bool operator<(const Node& input) {
return b > input.b;
}
};
const int maxn = 10007;
int n;
Node arr[maxn];
int main()
{
int kCase = 0;
while (cin >> n && n) {
for (int i = 0; i < n; i++) {
cin >> arr[i].a >> arr[i].b;
}
sort(arr, arr + n);
int ans = 0, cur = 0;
for (int i = 0; i < n; i++) {
cur += arr[i].a;
ans = max(cur + arr[i].b, ans);
}
cout << "Case "<<++kCase << ": "<< ans << endl;
}
return 0;
}
边栏推荐
猜你喜欢

Educator web exercises - Page node elements

五大(七大)原则-系统学习三

给表单组件添加说明

UML的六种关系-系统学习四

Educator web exercise - creating a text area

About SDRAM memory

PWM (pulse width modulation) of STM32 notes

Educator web exercises - grouping elements

Educoder Web练习题---创建输入控件

Generalized Focal Loss: Learning Qualified and Distributed Bounding Boxes for Dense Object Detection
随机推荐
i. MX - rt1052 sdcard operation (SDIO interface)
Phpstudy2018 installation and opening directory browsing
EKF 扩展卡尔曼滤波适用于全向地盘的修改方法
Redis最大内存淘汰策略
Embedded struct and embedded interface
【Appium踩坑】关闭inspector后打开weditor,uiautomator2.exceptions.NullPointerExceptionError: -32001 Jsonrpc er
云桌面是什么意思?与堡垒机有什么区别?
i. MX - rt1052 pulse width modulation (PWM)
Centos7 deploying MySQL environment
自定义view绘制折线图(支持缩放)
[100 unity step pit knowledge points] | collision box detection physics in unity OverlapBox、OverlapCaps
Educoder 表格标签-表格基本结构
Graveyard
Educoder Web练习题---创建输入控件
2. 引用
CP Instruction Learning
3D Slicer将分割结果保存
i. MX - rt1052 SPI and I2C interfaces
一文掌握SQLite3基本用法
Redis-bitmap 位图