当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6667:Roundgod and Milk Tea

题目描述
Roundgod is a famous milk tea lover at Nanjing University second to none. This year, he plans to conduct a milk tea festival. There will be $n$ classes participating in this festival, where the $i$th class has $a_i$ students and will make $b_i$ cups of milk tea.

Roundgod wants more students to savor milk tea, so he stipulates that every student can taste at most one cup of milk tea. Moreover, a student can't drink a cup of milk tea made by his class. The problem is, what is the maximum number of students who can drink milk tea?
输入解释
The first line of input consists of a single integer $T$ $(1 \leq T \leq 25)$, denoting the number of test cases.

Each test case starts with a line of a single integer $n$ $(1 \leq n \leq 10^6)$, the number of classes. For the next $n$ lines, each containing two integers $a, b$ $(0 \leq a, b \leq 10^9)$, denoting the number of students of the class and the number of cups of milk tea made by this class, respectively.

It is guaranteed that the sum of $n$ over all test cases does not exceed $6 \times 10^6$.
输出解释
For each test case, print the answer as a single integer in one line.
输入样例
1
2
3 4
2 1
输出样例
3
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6667

最后修改于 2020-10-25T23:33:19+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/6000MS(Java/Others) 131072/131072K(Java/Others)