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

建议使用的浏览器:

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

3851:Beat It!

题目描述
There's a monster-attacking game on the Renren's open platform, and the game's background are showing below.
Where lies a strange country, lices a strange monster. The strange people in that strange country are persecuted by the strange monster. So teh strange people make a strange cannon to defeat the strange monster.
As far as we know, the strange cannon is powerful, but once it works, it should not work in next T hours (Eg. If it fired at time 1, then time 2 to time T it cannot work). When the strange monster get hit during the daylight, it get PD point hurt; it will get PN point hurt when it happens during the night. As the country is strange, the time of the daylight and night changes eveyday. In the ith day, the daylight starts at time 1 and ends at time T1[i], then from time (T1[i]+1) to time (T1[i]+T2[i]) is night.
Here comes a question: what is the maximal hurt point would the strange monster got after N days?
输入解释
First line contains an integer Q (1<=Q<=20), indicates the number of test cases.
For each case, first line contains 4 integers: N (1<=N<=1000), T (1<=T<=100), PD, PN.
Then followed N lines, the (i+1)th line contains 2 integer T1[i], T2[i].
(PD, PN, T1[i], T2[i] are all non-negative and fit the 32bit integer)
输出解释
For each case print one line, output the answer. See the sample for format.

输入样例
1
2 5 20 5
6 10
2 1
输出样例
Case 1: 65
来自杭电HDUOJ的附加信息
Recommend chenyongfu

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

源链接: HDU-3851

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

共提交 0

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