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

建议使用的浏览器:

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

3990:Harry Potter and the Present

题目描述
Hogwarts is welcoming the new term! After Voldemort and the Death Eater were wiped out by Harry Potter and his friends, Harry becomes the glory of the Wizarding World, magician treat him as model, hero, king… and much more than that. So on the ceremony held to signal the beginning of a new school semester, they decide to invite Harry Potter and his three friends: Ginny, Ron and Hermione.
Back to their Alma Mater, Harry and his three friends find a store to purchase some present. They can use at most M units of money, what’s more, they don’t have enough energy to take the presents to Hogwarts if their total weight is exceeding W or the total number is exceeding S. In the store, there are N kinds of present, each of them has price Pi, weight Wi, and value Vi, and as it’s a magical world, any present’s amount is infinite and can be purchased for many times.
Unfortunately, all of them have different idea to buy the gifts. Ginny wants the total number to be the largest, while Ron thinks the more money they cost, the more sincerity there will be shown, Harry wonders the biggest weight they can take because he always likes to challenge himself, Hermione, of course, is already beginning to calculating the biggest value.
Here you see, your task is very simple, calculating the four numbers.
输入解释
The first line contains a single integer T, indicating the number of test cases.
Each test case begins with four integers N, S, W, M. Then N lines following, each line contains three integers Pi, Wi, Vi, describing a present.

Technical Specification

1. 1 <= T <= 100
2. 1 <= N <= 1 000
3. 1 <= S <= 1 000 000 000
4. 0 <= Wi, Pi, W, M <= 1 000
5. 0 <= W*M <= 1 000
6. 0 <= Vi <= 1 000 000
输出解释
For each test case, output the case number first, then four integers, indicating Ginny’s, Ron’s, Harry’s and Hermione’s answer, separated them by a blank. Their meaning should be the same with the description.
输入样例
2
2 2 3 4
1 1 2
1 2 3
2 3 3 4
1 1 2
1 2 3
输出样例
Case 1: 2 2 3 5
Case 2: 3 3 3 6
来自杭电HDUOJ的附加信息
Author iSea@WHU
Recommend lcy

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

源链接: HDU-3990

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

共提交 0

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