A. Carrot Cakes
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard 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.

Input

The only line contains four integers ntkd (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.

Output

If it is reasonable to build the second oven, print "YES". Otherwise print "NO".

Examples
input
8 6 4 5
output
YES
input
8 6 4 6
output
NO
input
10 3 11 4
output
NO
input
4 2 1 4
output
YES
Note

In 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的更多相关文章

  1. 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 ...

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

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

  3. cf Round 613

    A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...

  4. ARC下OC对象和CF对象之间的桥接(bridge)

    在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...

  5. [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现

    1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...

  6. 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 ...

  7. 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 ...

  8. CF #376 (Div. 2) C. dfs

    1.CF #376 (Div. 2)    C. Socks       dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...

  9. CF #375 (Div. 2) D. bfs

    1.CF #375 (Div. 2)  D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...

  10. CF #374 (Div. 2) D. 贪心,优先队列或set

    1.CF #374 (Div. 2)   D. Maxim and Array 2.总结:按绝对值最小贪心下去即可 3.题意:对n个数进行+x或-x的k次操作,要使操作之后的n个数乘积最小. (1)优 ...

随机推荐

  1. QQ空间g_tk、bkn加密参数算法

    g_tk是腾讯在QQ空间这一领域使用的密文,有写数据包或者url参数中需要加入你计算出的g_tk才能成功! 下面是通过浏览器抓包工具抓取 访问该js内容找出 QZONE.FrontPage.getAC ...

  2. FastDFS的配置、部署与API使用解读(8)FastDFS多种文件上传接口详解(转)

    1.StorageClient与StorageClient1的区别 相信使用happy_fish的FastDFS的童鞋们,一定都熟悉StorageClient了,或者你熟悉的是StorageClien ...

  3. Swift高阶函数介绍(闭包、Map、Filter、Reduce)

    Swift语言有非常多函数式编程的特性.常见的map,reduce,filter都有,初看和python几乎相同,以下简介下 闭包介绍: 闭包是自包括的功能代码块,能够在代码中使用或者用来作为參数传值 ...

  4. 安装DotNetCore.1.0.1-VS2015Tools.Preview2.0.3引发的血案

    1.下载了一个开源项目,是用netcore开发的 2.VS2015打不开解决方案 3.于是安装DotNetCore.1.0.1-VS2015Tools.Preview2.0.3 4.安装成功,项目顺利 ...

  5. c#冒泡法排序

    1.通过冒泡法实现一个int数组的有小到大的排序 代码如下: //用for语句来实现排序功能,冒泡排序 static void Sort(int[] number) { ; i < number ...

  6. 当半导体的工艺制程走到7nm后

    https://mp.weixin.qq.com/s/LjFTtEKFX2o8kLjn3y6GbQ 深度学习的异构加速技术1:效率因通用而怠,构架为AI而生 一方面,当半导体的工艺制程走到7nm后,已 ...

  7. Delphi的RTTI(许多参考链接)

    RTTI(RunTime Type Information): 运行时类型信息, 就是在程序运行后也能得到类型(譬如 TButton 类)的信息. 这在早期主要用于 IDE 设计时, 譬如把一个 Bu ...

  8. Java其实不支持垃圾回收

    Java其实不支持垃圾回收.如果真的支持的话,大多数Java程序在运行的一开始就应该把程序本身删除,因为这些程序本身就是垃圾.   // TODO: This is a 分割线. Please no ...

  9. Docker的远程访问

    $docker : info (10.211.55是另一台服务器的地址) 频繁访问远程的docker服务器使用-H选项很麻烦,使用环境变量DOCKER_HOST, $export DOCKER_HOS ...

  10. 安装MySQLdb出现的问题

    枫竹梦的环境是自己编译安装的MySQL,安装目录在/usr/local/mysql. 下载MySQLdb,由于网络上大多数的链接都是指向比较老的sourceforge上,而我们安装最新的1.2.5,h ...