Codeforces Round #471 (Div. 2)A. Feed the cat
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 ≤ 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 .
19 00
255 1 100 1
25200.0000
17 41
1000 6 15 11
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的更多相关文章
- Codeforces Round #471 (Div. 2) C. Sad powers
首先可以前缀和 ans = solve(R) - solve(L-1) 对于solve(x) 1-x当中符合条件的数 分两种情况 3,5,7,9次方的数,注意这地方不能含有平方次 平方数 #inclu ...
- Codeforces Round #471 (Div. 2) F. Heaps(dp)
题意 给定一棵以 \(1\) 号点为根的树.若满足以下条件,则认为节点 \(p\) 处有一个 \(k\) 叉高度为 \(m\) 的堆: 若 \(m = 1\) ,则 \(p\) 本身就是一个 \(k\ ...
- 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 ...
- Codeforces Round #554 (Div. 2) 1152B. Neko Performs Cat Furrier Transform
学了这么久,来打一次CF看看自己学的怎么样吧 too young too simple 1152B. Neko Performs Cat Furrier Transform 题目链接:"ht ...
- Codeforces Round #554 (Div. 2) B. Neko Performs Cat Furrier Transform(思维题+log2求解二进制位数的小技巧)
传送门 题意: 给出一个数x,有两个操作: ①:x ^= 2k-1; ②:x++; 每次操作都是从①开始,紧接着是② ①②操作循环进行,问经过多少步操作后,x可以变为2p-1的格式? 最多操作40次, ...
- 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 ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
随机推荐
- java并发之并发工具
在JDK的并发包里提供了几个非常有用的并发工具类.CountDownLatch.CyclicBarrier和Semaphore工具类提供了一种并发流程控制的手段,Exchanger工具类则提供了在线程 ...
- dancing links 题集转自夏天的风
POJ3740 Easy Finding [精确覆盖基础题] HUST1017 Exact cover [精确覆盖基础] HDOJ3663 Power Stations [精确覆盖] Z ...
- php7 使用imagick 的坑
imagick是一个PHP的扩展,用ImageMagick提供的API来进行图片的创建与修改,不过这些操作已经包装到扩展imagick中去了,最终调用的是ImageMagick提供的API. Imag ...
- n!最末尾非0数
最小周期串:如果s是ss的周期串,那么ss就可以表示成几个周期的s,如果s是ss的最小周期串,那么s就是ss的周期串中最小的一个.例,ZgxZgxZgxZgx的最小周期串是Zgx.{很好理解} 给你一 ...
- 导致“mysql has gone away”的两种情况
导致“mysql has gone away”的两种情况 By Cruise 1. wait_timeout参数 在开发代理server时, 我使用了jdbc连接数据库,并采用长连接的方式连接数据库 ...
- 好纠结啊,JeeWx商业版本号和开源版本号有什么差别呢?
好纠结啊,JeeWx商业版本号和开源版本号有什么差别呢? JeeWx开源版本号是一套基础微信开发平台.有基础的微信菜单.素材管理.微信对接等基础功能,适合于开发人员学习研究. JeeWx商业版本号是一 ...
- spring的bean管理(注解和配置文件混合使用)
1.建三个类,在一个类中引用其他两个类 import javax.annotation.Resource; import org.springframework.beans.factory.annot ...
- EOJ 3348 树的顺序存储结构
前面介绍了树的链式存储结构,那么如何用顺序存储来存储一棵树呢?在顺序存储时,我们除了存储每个结点值外,还要存储树中结点与结点之间的逻辑关系(即双亲与孩子结点之间的关系).下面介绍树的双亲存储法. 编号 ...
- HDU2034 人见人爱 A - B
2019-05-17 09:37:46 加油,加油 !!! 结果要从小到大输出 NULL后面没有空格 m && n == 0才结束 注意:看题仔细,罚时很严重 #include < ...
- VirtualBox 5.1.14 获取VirtualBox COM对象错误
Oracle VM VirtualBox 5.1.14 安装完成之后显示错误, Failed to instantiate CLSID_VirtualBox w/ IVirtualBox, but C ...