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)优 ...
随机推荐
- Excel应用----制作二级下拉菜单【转】
应用: 原始数据源是两列的源数据,那该如何制作二级下拉菜单, 当然可以将这两列的数据源,转换成上面的那种格式,再用上面的方法来制作. 今天教大学的方法是直接通过这种两列式的数据源来制作下拉菜单,如果A ...
- ARP协议(1)什么是ARP协议
这是最近在看<TCP/IP具体解释>系列书总结出来的,之后会陆续把其它协议部分分享出来. 我尽量以简单易读.易懂的方式呈现出来,可是,因为文笔和水平有限.有些地方或许存在描写叙述上的不足或 ...
- Retimer、Redriver(Level Shifter)
重定时器Retimer和驱动器Redriver9(Level Shifter) 在高速串行通道的信号传输中,需要使用Redriver 和Retimer来保证信号传输的质量. Redriver,可以重新 ...
- oracle insert/update
insert into table (,,) values (,,) where update table set (,)=(select , from ) where
- git 忽略文件的三种方式
1. 在项目目录下新建.gitignore文件并添加规则 特点:此种方式的忽略规则只局限于本项目目录及其子目录,并且.gitignore文件会被提交到远程仓库进行共享忽略规则. 2. 在.git/in ...
- ubuntu + lamp + laravel 环境配置
首先是LAMP 安装顺序是 A(Apache服务器) M(Mysql) P(Php) 安装apache sudo apt-get install apache2 安装mysql sudo apt-g ...
- ppycharm设置解释器版本号码
在pycharm中点击File,之后在弹出的窗口中输入Project Interpreter,点击之后就可以看到自己的解释器版本是多少了,也可以随意选择想要用的解释器版本号码:
- 转载---- 使用opencv源码自己编制android so库的过程
http://blog.csdn.net/lantishua/article/details/21182965 工作需要,在Android上使用OpenCV.opencv当前的版本(2.4.8)已经有 ...
- .NET MVC 4 实现邮箱激活账户功能
这篇文章是<.NET MVC 4 实现用户注册功能>的后续开发,实现发送激活链接到注册用户邮箱,用户在邮箱打开链接后激活账户的功能. 首先实现发送邮件的功能,在管理用户注册的control ...
- (转载)JavaScript递归查询 json 树 父子节点
在Json中知道某个属性名,想要确定该属性在Json树具体的节点,然后进行操作还是很麻烦的 可以用以下方法找到该属性所在的节点,和父节点 <!DOCTYPE html> <html ...