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

建议使用的浏览器:

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

7026:Might and Magic

题目描述
Two heroes are fighting, whose names are hero $0$ and hero $1$ respectively.

You are controlling the hero $0$, and your enemy is the hero $1$. Each hero has five integer attributes: ATTACK, DEFENCE, POWER, KNOWLEDGE, and HEALTH. When two heroes battle with each other, they will take turns to attack and your hero moves first. One hero can make $\pmb{\text{exactly one attack}}$ in one turn, either a physical attack or a magical attack.

Assume their attritubes are $A_i,D_i,P_i,K_i,H_i(0 \leq i \leq 1)$. For hero $i$, its physical attack's damage is $C_p \max(1,A_i-D_{1-i})$ while its magical attack's damage is $C_m P_i$ where $C_p, C_m$ are given constants.

Hero $i$ can make magical attacks no more than $K_i$ times in the whole battle. After hero $i$'s attack, $H_{1-i}$ will decrease by the damage of its enemy. If $H_{1-i}$ is lower or equal to $0$, the hero $(1-i)$ loses and the battle ends.

Now you know your enemy is Yog who is utterly ignorant of magic, which means $P_1=K_1=0$ and he will only make physical attacks. You can distribute $N$ attribute points to four attributes $A_0, D_0, P_0, K_0$ arbitrarily which means these attributes can be any non-negative integer satisfying $0 \leq A_0+D_0+P_0+K_0 \leq N$.

Given $C_p,C_m,H_0,A_1,D_1$ and $N$, please calculate the maximum $H_1$ that you have a chance to win.
输入解释
The first line contains an integer $T(1 \leq T \leq 10^5)$ - the number of test cases. Then $T$ test cases follow.

The only line of each test case contains six integers $C_p,C_m,H_0,A_1,D_1,N(1 \leq C_p,C_m,H_0,A_1,D_1,N \leq 10^6)$ - attritubes described above.
输出解释
For each test case, output one integer representing the answer.
输入样例
2
1 1 4 5 1 4
2 5 1 9 9 6
输出样例
4
25

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

源链接: HDU-7026

最后修改于 2021-10-23T19:11:06+00:00 由爬虫自动更新

共提交 0

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