305027: CF955A. Feed the cat

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Feed the cat

题意翻译

## 题意翻译 安德鲁在 $hh:mm$ 时刻醒来后,意识到他又忘记喂他唯一的猫了(~~猜猜为什么只有一只猫~~)。猫现在的饥饿程度是 $H$ 点,而且每分钟没有食物都会增加 $D$ 点的饥饿感。 在任何时候,安德鲁都可以去一家卖美味面包的商店(你可以假设去商店和回来不需要时间)。一个这样的小圆面包要花费 $C$ 卢布,减少 $N$ 点的饥饿感。由于对面包店的需求在晚上大幅下降,因此从 20:00 开始,面包有 $20%$ 的特别折扣(注意,成本可能会变得合理)。当然,小圆面包不能分批出售。 确定安德鲁为养猫必须花费的最低金额。如果这只猫的饥饿程度小于或等于零,它就被认为是被喂养的。 ## 输入输出格式 ### 输入格式 第一行包含两个整数 $hh$ 和 $mm$ $(00 \leq hh \leq 23,00 \leq mm \leq59)$ 表示安德鲁苏醒的时间。 第二行包含四个整数 $H,D,C$ 和 $N$ $(1 \leq H \leq 10^5,1 \leq D,C,N \leq 100)$ ### 输出格式 将最小金额输出到小数点后三位以内。如果您的答案和评测机的答案误差不超过 $10^{-4}$,则认为您的回答是正确的。 ## 说明 在第一个样本中,安德鲁可以在 $20$ 点 $20$ 分准时去商店。猫的饥饿将等于 $315$,因此有必要购买 $315$ 个小圆面包。最后的答案是 $25200$ 卢布。 在第二个样本中,他醒来后立刻去商店是最佳选择。然后他每 $15$ 卢布就要买 $91$ 个小圆面包,总共要花 $1365$ 卢布。

题目描述

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.

输入输出格式

输入格式


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<=10^{5},1<=D,C,N<=10^{2}) $ .

输出格式


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 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF955A/65fd7529ab98005b0b4193b9c8a475f5e4565192.png).

输入输出样例

输入样例 #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.

Input

题意翻译

## 题意翻译 安德鲁在 $hh:mm$ 时刻醒来后,意识到他又忘记喂他唯一的猫了(~~猜猜为什么只有一只猫~~)。猫现在的饥饿程度是 $H$ 点,而且每分钟没有食物都会增加 $D$ 点的饥饿感。 在任何时候,安德鲁都可以去一家卖美味面包的商店(你可以假设去商店和回来不需要时间)。一个这样的小圆面包要花费 $C$ 卢布,减少 $N$ 点的饥饿感。由于对面包店的需求在晚上大幅下降,因此从 20:00 开始,面包有 $20%$ 的特别折扣(注意,成本可能会变得合理)。当然,小圆面包不能分批出售。 确定安德鲁为养猫必须花费的最低金额。如果这只猫的饥饿程度小于或等于零,它就被认为是被喂养的。 ## 输入输出格式 ### 输入格式 第一行包含两个整数 $hh$ 和 $mm$ $(00 \leq hh \leq 23,00 \leq mm \leq59)$ 表示安德鲁苏醒的时间。 第二行包含四个整数 $H,D,C$ 和 $N$ $(1 \leq H \leq 10^5,1 \leq D,C,N \leq 100)$ ### 输出格式 将最小金额输出到小数点后三位以内。如果您的答案和评测机的答案误差不超过 $10^{-4}$,则认为您的回答是正确的。 ## 说明 在第一个样本中,安德鲁可以在 $20$ 点 $20$ 分准时去商店。猫的饥饿将等于 $315$,因此有必要购买 $315$ 个小圆面包。最后的答案是 $25200$ 卢布。 在第二个样本中,他醒来后立刻去商店是最佳选择。然后他每 $15$ 卢布就要买 $91$ 个小圆面包,总共要花 $1365$ 卢布。

加入题单

算法标签: