Roundgod and Milk Tea (HTU-6667)

这篇博客讨论了南京大学举办的一场由Roundgod主持的奶茶节。每个班级有特定的学生数量和制作的奶茶杯数,学生限喝一杯且不能喝本班制作的。问题在于最多能有多少学生喝到奶茶。博客提供了样例输入输出,并解释了题目难点,即需要考虑每个班级不能消耗自己生产的奶茶。最后给出了解题思路。
摘要由CSDN通过智能技术生成

Roundgod and Milk Tea (HTU-6667)


HTU-6667

题目

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 ith class has ai students and will make bi 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≤T≤25), denoting the number of test cases.

Each test case starts with a line of a single integer n (1≤n≤10^6), the number of classes. For the next n lines, each containing two integers a,b (0≤a,b≤10^9), denoting the number of students of the clas

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值