CF955A.Feed the cat
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.
At any time Andrew can visit the store where tasty buns are sold (you can assume that is doesn't take time to get to the store and back). One such bun costs C roubles and decreases hunger by N points. Since the demand for bakery drops heavily in the evening, there is a special 20% discount for buns starting from 20:00 (note that the cost might become rational). Of course, buns cannot be sold by parts.
Determine the minimum amount of money Andrew has to spend in order to feed his cat. The cat is considered fed if its hunger level is less than or equal to zero.
安德鲁在 hh:mm 醒来,意识到自己又一次忘记喂他唯一的猫了(猜猜为什么只有一只猫)。此时猫的饥饿值为 H 点,且此后每过一分钟,若仍未进食,其饥饿值将增加 D 点。
在任意时刻,安德鲁均可前往商店购买美味的面包卷(可假设往返商店不耗时)。每个面包卷售价为 C 卢布,能降低猫的饥饿值 N 点。由于傍晚烘焙食品需求大幅下降,从 20:00 起,面包卷享有 20% 的折扣(注意:折扣后价格可能为有理数)。当然,面包卷不可拆分销售。
请确定安德鲁为喂饱猫所需花费的最少金额。当猫的饥饿值 小于或等于零 时,即视为已被喂饱。
输入格式
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening.
The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
第一行包含两个整数 hh 和 mm(00≤hh≤23,00≤mm≤59)——表示安德鲁醒来的时间。
第二行包含四个整数 H、D、C 和 N(1≤H≤105,1≤D,C,N≤102)。
输出格式
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4.
Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
.
输出最小金额,保留三位小数。若你的答案的绝对误差或相对误差不超过 10−4,则视为正确。
形式化地,设你的答案为 a,评测组的答案为 b。当满足
时,你的答案被视为正确。
输入输出样例
输入#1
19 00 255 1 100 1
输出#1
25200.0000
输入#2
17 41 1000 6 15 11
输出#2
1365.0000
说明/提示
In the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.
In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per 15 roubles each and spend a total of 1365 roubles.
在第一个样例中,安德鲁可以在恰好 20:00 访问商店。此时猫的饥饿值为 315,因此需要购买 315 个包子。折扣后的最终答案为 25200 卢布。
在第二个样例中,最优策略是在他刚醒来后立即访问商店。此时他需以每个 15 卢布的价格购买 91 个包子,总共花费 1365 卢布。
输入解题思路,AI测评打分。不知道怎么写?