CF-799A
A. Carrot Cakestime limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
In some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the same moment t minutes after they started baking. Arkady needs at least n cakes to complete a task, but he currently don't have any. However, he has infinitely many ingredients and one oven. Moreover, Arkady can build one more similar oven to make the process faster, it would take d minutes to build the oven. While the new oven is being built, only old one can bake cakes, after the new oven is built, both ovens bake simultaneously. Arkady can't build more than one oven.
Determine if it is reasonable to build the second oven, i.e. will it decrease the minimum time needed to get n cakes or not. If the time needed with the second oven is the same as with one oven, then it is unreasonable.
InputThe only line contains four integers n, t, k, d (1 ≤ n, t, k, d ≤ 1 000) — the number of cakes needed, the time needed for one oven to bake k cakes, the number of cakes baked at the same time, the time needed to build the second oven.
OutputIf it is reasonable to build the second oven, print "YES". Otherwise print "NO".
Examplesinput8 6 4 5outputYESinput8 6 4 6outputNOinput10 3 11 4outputNOinput4 2 1 4outputYESNoteIn the first example it is possible to get 8 cakes in 12 minutes using one oven. The second oven can be built in 5 minutes, so after 6minutes the first oven bakes 4 cakes, the second oven bakes 4 more ovens after 11 minutes. Thus, it is reasonable to build the second oven.
In the second example it doesn't matter whether we build the second oven or not, thus it takes 12 minutes to bake 8 cakes in both cases. Thus, it is unreasonable to build the second oven.
In the third example the first oven bakes 11 cakes in 3 minutes, that is more than needed 10. It is unreasonable to build the second oven, because its building takes more time that baking the needed number of cakes using the only oven.
题意:
总共要烤n个蛋糕,开始有一个烤炉,每个烤炉可以在t分钟内出k个蛋糕,而再做一个烤炉要花费d分钟,问是否需要再做一个烤炉使总时间减少。
首先我们要算出一个烤炉需要几个t才能完成,然后总时间减掉d算出这段时间第二个烤炉的工作量再加上一直在工作的第一个烤炉的量,若比之前多则为YES。
注意样例2的情况
附AC代码:
#include<bits/stdc++.h>
using namespace std; int main(){
int n,t,k,d;
cin>>n>>t>>k>>d;
int x,y,z;
if(n%k)
n+=k-n%k;
x=n/k;
y=x*t-;//t==d且x==2时为NO
z=(y-d)/t+y/t;
if(z>=x)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return ;
}
CF-799A的更多相关文章
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- cf Round 613
A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...
- ARC下OC对象和CF对象之间的桥接(bridge)
在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...
- [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现
1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...
- CF memsql Start[c]UP 2.0 A
CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...
- CF memsql Start[c]UP 2.0 B
CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 25 ...
- CF #376 (Div. 2) C. dfs
1.CF #376 (Div. 2) C. Socks dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...
- CF #375 (Div. 2) D. bfs
1.CF #375 (Div. 2) D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...
- CF #374 (Div. 2) D. 贪心,优先队列或set
1.CF #374 (Div. 2) D. Maxim and Array 2.总结:按绝对值最小贪心下去即可 3.题意:对n个数进行+x或-x的k次操作,要使操作之后的n个数乘积最小. (1)优 ...
随机推荐
- Python生成8位随机字符串的一些方法
#第一种方法 import random import string seed = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP ...
- Ubuntu16.04下Django项目的部署
起飞前的准备 # 首先在Ubuntu的当前用户zhang下新建data文件夹,然后在data文件夹下新建你的项目目录root@zhang-virtual-machine:/home/zhang/dat ...
- how to run a continuous background task on OpenShift
https://stackoverflow.com/questions/27152438/best-way-to-run-rails-background-jobs-with-openshift ht ...
- 通过Pojo对象 field 属性加注解实现格式校验,极大的降低代码量
近期做一个接口.接受外系统的报文,通过XStream转换成java对象以后.须要对当中的字段做格式校验. 要求例如以下: 传统的方式是硬编码校验.可是对于field非常多的情况.代码量暴增.easy出 ...
- xpath 节点1
XPath 含有超过 100 个内建的函数.这些函数用于字符串值.数值.日期和时间比较.节点和 QName 处理.序列处理.逻辑值等等. 节点(Node) 在 XPath 中,有七种类型的节点:元素. ...
- MVC5中使用jQuery Post 二维数组和一维数组到Action
很久没有写了,最近在做一个MVC项目,这是我做的第一个MVC项目.之前可以说多MVC一点都不了解,今天把昨天遇到的一个问题记录下来.MVC大神就请飘过吧,跟我遇到同样问题的可以进来看看.遇到的第一个问 ...
- mvc 发送QQ邮件
试图部分代码: @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; } ...
- ickeck插件
地址:http://www.bootcss.com/p/icheck/#skins 使用 1. 先引入文件 css <link rel="stylesheet" type=& ...
- src/github.com/mongodb/mongo-go-driver/mongo/cursor.go 游标的简洁实用
src/github.com/mongodb/mongo-go-driver/mongo/cursor.go // Copyright (C) MongoDB, Inc. 2017-present./ ...
- JVM无法启动,jps无法运行,提示内存不足
原因:系统设置中有设置了不允许over commit so,无法分配足够内存 /etc/sysctl.conf vm.overcommit_memory=1 或者sysctl vm.overco ...