CF487A.Fight the Monster
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A monster is attacking the Cyberland!
Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (HP), offensive power (ATK) and defensive power (DEF).
During the battle, every second the monster's HP decrease by max(0, ATK__Y - DEF__M), while Yang's HP decreases by max(0, ATK__M - DEF__Y), where index Y denotes Master Yang and index M denotes monster. Both decreases happen simultaneously Once monster's HP ≤ 0 and the same time Master Yang's HP > 0, Master Yang wins.
Master Yang can buy attributes from the magic shop of Cyberland: h bitcoins per HP, a bitcoins per ATK, and d bitcoins per DEF.
Now Master Yang wants to know the minimum number of bitcoins he can spend in order to win.
一只怪物正在进攻网络国!
勇士杨大师将要击败这只怪物。杨大师与怪物各有三项属性:生命值(HP)、攻击力(ATK)和防御力(DEF)。
在战斗中,每秒怪物的生命值减少量为 max(0, ATKY − DEFM),而杨大师的生命值减少量为 max(0, ATKM − DEFY),其中下标 Y 表示杨大师,下标 M 表示怪物。这两项生命值减少同时发生。当怪物的 HP ≤ 0 且 同一时刻杨大师的 HP > 0 时,杨大师获胜。
杨大师可从网络国的魔法商店购买属性:每点 HP 需花费 h 比特币,每点 ATK 需花费 a 比特币,每点 DEF 需花费 d 比特币。
现在,杨大师想知道:为确保获胜,他最少需要花费多少比特币?
输入格式
The first line contains three integers HP__Y, ATK__Y, DEF__Y, separated by a space, denoting the initial HP, ATK and DEF of Master Yang.
The second line contains three integers HP__M, ATK__M, DEF__M, separated by a space, denoting the HP, ATK and DEF of the monster.
The third line contains three integers h, a, d, separated by a space, denoting the price of 1 HP, 1 ATK and 1 DEF.
All numbers in input are integer and lie between 1 and 100 inclusively.
第一行包含三个整数 HPY、ATKY、DEFY,以空格分隔,分别表示杨大师的初始生命值(HP)、攻击力(ATK)和防御力(DEF)。
第二行包含三个整数 HPM、ATKM、DEFM,以空格分隔,分别表示怪物的生命值(HP)、攻击力(ATK)和防御力(DEF)。
第三行包含三个整数 h、a、d,以空格分隔,分别表示 1 点生命值(HP)、1 点攻击力(ATK)和 1 点防御力(DEF)的价格。
输入中的所有数字均为整数,且均在 1 到 100(含)之间。
输出格式
The only output line should contain an integer, denoting the minimum bitcoins Master Yang should spend in order to win.
唯一的一行输出应包含一个整数,表示杨大师为获胜所需花费的最少比特币数量。
输入输出样例
输入#1
1 2 1 1 100 1 1 100 100
输出#1
99
输入#2
100 100 100 1 1 1 1 1 1
输出#2
0
说明/提示
For the first sample, prices for ATK and DEF are extremely high. Master Yang can buy 99 HP, then he can beat the monster with 1 HP left.
For the second sample, Master Yang is strong enough to beat the monster, so he doesn't need to buy anything.
对于第一个样例,ATK 和 DEF 的价格极高。杨大师可以购买 99 点 HP,然后以剩余 1 点 HP 击败怪物。
对于第二个样例,杨大师已足够强大,能够直接击败怪物,因此无需购买任何物品。
输入解题思路,AI测评打分。不知道怎么写?