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

建议使用的浏览器:

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

1692:Destroy the Well of Life

题目描述
In the game of DotA (Defense of the Ancient), there are two opposite legions called The Sentinel and The Scourage.
Now The Scourage has made a big success and The Sentinel is at stake!
So The Sentinel must destroy the Well of Life of The Scourage.
The chief of The Sentinel, Prophet, asks EarthShaker to do this arduous task.

There are N Wells of Life of The Scourage (The Wells of Life are numbered from 1 to N), and EarthShaker’s task is to destroy the Nth Well of Life.
The following information is known about each Well of Life:
Wi – the weight of water on i-th Well of Life before it is destroyed.
Li – if the weight of water on i-th Well of Life is more than Li, the i-th Well of Life will be destroyed and the water of it will pours to the (i + 1)-th Well of Life.
Pi – EarthShaker has a skill called Echo-Slam, the i-th Well of Life will be immediately destroyed when he uses Echo-Slam to it and the water of it will pours to the (i + 1)-th Well of Life. For the i-th Well of Life, the energy that EarthShaker need to use Echo-Slam to destroy it is Pi.

Can you tell EarthShaker the minimum amount of energy needed to destroy the Nth Well of Life?


输入解释
The input consists of several test cases. There is a single number on the first line, the number of cases. There are no more than 10 cases.
Each case contains a natural number N on the first line, 1<=N<=100,000.
Following N lines contains three numbers Wi, Li, Pi (Wi<=Li, 0<=Wi, Li, Pi <=20,000), representing the information of the i-th Well of Life.
输出解释
For each case, print a number in a line representing the least amount of energy EarthShaker needed to use, so as to destroy the Nth Well of Life. Use the format in the sample.
输入样例
1
3
1000 1000 1 
0 1000 2 
2 10 100
输出样例
Case 1: Need to use 3 mana points.
来自杭电HDUOJ的附加信息
Recommend wangye

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

源链接: HDU-1692

最后修改于 2020-10-25T22:47:15+00:00 由爬虫自动更新

共提交 0

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