当前位置:网站首页>uva11729
uva11729
2022-06-21 12:28:00 【小刀刺大熊】
#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;
}
边栏推荐
猜你喜欢

RPC (remote procedure call protocol)

i. MX - rt1052 SPI and I2C interfaces

Understand UML class diagram and sequence diagram

Nanjing University static program analyses -- intermediate representation learning notes

Introduction to CPU, MPU, MCU, SOC and MCM

Redis bitmap

常用的17个运维监控系统

【无标题】

Educoder Web练习题---对表单元素分组

2022年CIO需要关注的九个趋势和优先事项
随机推荐
Construction scheme and installation position of intelligent auxiliary system in power distribution room
PingCAP 入选 2022 Gartner 云数据库“客户之声”,获评“卓越表现者”最高分
Apache shardingsphere 5.1.2 release | new driving API + cloud native deployment to create a high-performance data gateway
自定义view绘制折线图(支持缩放)
给表单组件添加说明
Creation mode - singleton mode
Huawei cloud releases desktop ide codearts
[100 unity practical skills] | obtain the coordinates of mouse clicks in the game and move the game object to the click position of the mouse
CPU、MPU、MCU、SoC、MCM介绍
方法的繼承和重寫
Educoder 表格标签-表格基本结构
Vs code + GDB download and debugging of STM32 development
STM32笔记之 PWM(脉宽调制)
Transaction
常用的17个运维监控系统
【毕业季·进击的技术er】大学生涯的成长之路
WPF uses Maui's self drawing logic
一文掌握SQLite3基本用法
Five (seven) principles - systematic learning III
~~~~配置