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.

Input

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 HDC and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).

Output

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 .

Examples
input
19 00
255 1 100 1
output
25200.0000
input
17 41
1000 6 15 11
output
1365.0000

题意:给定Andrew醒来时间,醒来时候猫的饥饿度,猫每分钟增长饥饿度,一份猫食价格,一份猫食能消除的饥饿度;现在有两种方案,一种是醒来直接买猫食,一种是到20:00后买猫食可以打八折,输出最省钱方案花费的钱数。
复制粘贴出错了还过了预判,然后终判wa了,难受


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
#define eps 0.00000001
#define pn printf("\n")
using namespace std;
typedef long long ll; int main()
{
ll hh,mm,h,d,c,n;
cin >> hh >> mm >> h >> d >> c >> n;
if(hh < )
{
double cur = (h / n + (h%n != ))*1.0 * c;
double cut = ((( * - hh* - mm)*d + h)/n + ((( * - hh* - mm)*d+h)%n != )) * c * 0.8;
printf("%.4f\n",min(cur,cut));
}
else
printf("%.4f\n", (h / n + (h%n != ))*0.8 * c); }

Codeforces Round #471 (Div. 2)A. Feed the cat的更多相关文章

  1. Codeforces Round #471 (Div. 2) C. Sad powers

    首先可以前缀和 ans = solve(R) - solve(L-1) 对于solve(x) 1-x当中符合条件的数 分两种情况 3,5,7,9次方的数,注意这地方不能含有平方次 平方数 #inclu ...

  2. Codeforces Round #471 (Div. 2) F. Heaps(dp)

    题意 给定一棵以 \(1\) 号点为根的树.若满足以下条件,则认为节点 \(p\) 处有一个 \(k\) 叉高度为 \(m\) 的堆: 若 \(m = 1\) ,则 \(p\) 本身就是一个 \(k\ ...

  3. Codeforces Round #471 (Div. 2)B. Not simply beatiful strings

    Let's call a string adorable if its letters can be realigned in such a way that they form two conseq ...

  4. Codeforces Round #554 (Div. 2) 1152B. Neko Performs Cat Furrier Transform

    学了这么久,来打一次CF看看自己学的怎么样吧 too young too simple 1152B. Neko Performs Cat Furrier Transform 题目链接:"ht ...

  5. Codeforces Round #554 (Div. 2) B. Neko Performs Cat Furrier Transform(思维题+log2求解二进制位数的小技巧)

    传送门 题意: 给出一个数x,有两个操作: ①:x ^= 2k-1; ②:x++; 每次操作都是从①开始,紧接着是② ①②操作循环进行,问经过多少步操作后,x可以变为2p-1的格式? 最多操作40次, ...

  6. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  7. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  8. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  9. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

随机推荐

  1. navicat 为表添加索引

    navicat 为表添加索引 分析常用的查询场景,为字段添加索引,增加查询速度. 可以添加单列索引,可以添加联合索引. 右键,设计表中可以查看和添加修改索引! 索引一定要根据常用的查询场景进行添加! ...

  2. BZOJ——T 1053: [HAOI2007]反素数ant

    http://www.lydsy.com/JudgeOnline/problem.php?id=1053 Description 对于任何正整数x,其约数的个数记作g(x).例如g(1)=1.g(6) ...

  3. UVa Problem 10051

    这题有点类似LIS,由于颜色最多100种,所以只需建立一个100的数组,按对立面的关系以某种颜色为向上面的最大值就可以了.   #include <iostream> #include & ...

  4. Cocos Code IDE里xcodeprojectlua脚本更新

    lua脚本改动后xcode须要clean又一次编译才干更新,这个是xcode里的老毛病了,网上有一些脚本但不是针对Cocos Code IDE的project文件夹的,这里列出 cocos2dx版本号 ...

  5. spring5.0新特性

    spring5.0新特性 学习了:http://blog.csdn.net/u012562943/article/details/77449666 https://www.cnblogs.com/xu ...

  6. Ruby 教程

    Ruby 教程 http://www.runoob.com/ruby/ruby-tutorial.html http://guides.rubyonrails.org/getting_started. ...

  7. Coco2d-js/Cocos2d-html5中Android返回键实现

    导语: 首先Cocos2d-x其中实现Menu和Back按键相对简单一点,而在资源较少的Cocos2d-html5其中.要实现返回还是有一点不一样的,并且有没有详细的demo.也就仅仅有自己去看api ...

  8. 关于TRIANGLE二维三角网格生成器在windows下的配置说明

    近期须要用到三角网格生成的一些东西,所以就把TRIANGLE这个库编译了一下,发现编译过程还是略微有些纠结,于是就想到写下来.希望以后有些童鞋看到少走一些弯路. 首先很感谢eryar的帮助,很感谢! ...

  9. android中LocalBroadcastManager的使用

    今天遇到一个acitivity之间通信的问题,因为我们是用TabActivity包裹了Activity(我们称之为A).所以这两个Activity是同一时候存在的.当在TabActivity中启动其它 ...

  10. PlayerPrefs存储Vector3等结构数据

     孙广东   2016.3.31 之前有网友询问这个问题, 当时我仅仅是 提供了一个思路, 使用json序列化.反序列化. 以下就写出两种(都是仅仅能变成字符串) 1.json的序列化.反序列化方 ...