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

建议使用的浏览器:

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

6619:Horse

题目描述
There is a horse which can jump over trees and he has to jump N trees sequentially.
Initially, the horse has zero energy.
Jumping trees, he loses energy (one unit of energy per unit of height) and he gets points as the amount of left energy (Left energy can be less than 0).
And his final score is the sum of all points that the horse gets after each jump.
The horse can do two types of tricks.
*Just before every jump, he can eat a tree. Of course, he jumps over the eaten tree which has no height.
*Just after every jump, he can have a break. After each break, he restores energy. It means that his energy becomes the total sum of heights of all eaten trees.
But he has limits, he can have at most K breaks and eat at most M trees.
You have to find the maximum score that the horse can gets.
输入解释
The first line contains an integer T (1 <= T <= 10) denoting the number of test cases.
The first line of each test case contains three integers N (1 <= N <= 10000), K (0 <= K <= min (50, N - 1)) and M (0 <= M <= min (50, N)).
The second line of each test case contains N integers h1, h2 … hn (1 <= hi <= 10000), where hi denote the height of ith tree.
输出解释
For each test case, print the maximum score that the horse can gets.
输入样例
3
4 1 1
4 2 3 1
4 2 4
4 2 3 1
10 2 3
2 3 4 5 6 2 7 4 3 1
输出样例
-1
17
25

提示
For the first test case, the answer is that the horse eats the first tree and has a break after the second jump.
For the second test case, the horse has breaks after the first and third jump and eats all trees.
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6619

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

共提交 0

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