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

建议使用的浏览器:

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

4070:Phage War

题目描述
Phage War is a little flash game. In this game, we want infect all cells by the transmission and breed of phages.
Originally, there is a cell infected by phages and this cell can breed a new phage every second. You should know that only the new born phages can inject other cells.

There are n cells around this cell, numbered from 1 to n. If there are Di phages reaching the i-th cell, the cell would be infected, and the phages journey will cost Ti seconds. To simplify it, we assume these phages will stay in this new cell and they can’t infect other cells. And the new cell cannot breed new phages and infect other cells.
Can you tell me how much time it costs to infect all cells at least?
输入解释
In the first line there is an integer T (T <= 50), indicates the number of test cases.
In each case, the first line contains a integers N (1 <= N <= 10^5). Then there are N lines, each line contain two integers Di, Ti (1<=Di, Ti<=100).
输出解释
For each case, output the least time needed in one line.(as shown in the sample output)
输入样例
2
2
2 1
5 6
2
1 11
3 10
输出样例
Case 1: 11
Case 2: 14
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-4070

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

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)