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 ;
}

最新文章

  1. MySql 获取表的字段名
  2. 互联网中一些常用指标(PV、UV、蹦失率、转换率、退出率)
  3. 可提高工作效率的 PL/SQL Developer 设置
  4. iOS学习03C语言循环结构
  5. Java泛型总结(转)
  6. linux 大量的TIME_WAIT解决办法
  7. flexbox 兼容安卓4.3
  8. js——DOM操作(二)
  9. Apache/nginx转发设置-分布式部署
  10. UWP开发技巧:实现SMB协议操作文件服务器文件
  11. 解析PHP面向对象的三大特征
  12. MapReduce框架Hadoop应用(一)
  13. 315道python面试题(参考答案)
  14. Request Body可以反复读取的方法
  15. 优化MySQL性能的几种方法-总结
  16. 2018年天梯赛LV2题目汇总小结
  17. 【Java】 剑指offer(27) 二叉树的镜像
  18. oracle开发学习篇之集合函数
  19. 百度2017春招&lt;度度熊回家问题&gt;
  20. JS与JAVA数据类型的区别

热门文章

  1. nightwatch.js - scroll until element is visible
  2. PC常用电源IC、MOS、三极管、二极管厂家
  3. 笔记04 WPF对象引用
  4. 服务管理-DHCP、NTP、SSH
  5. YARN和MapReduce的内存设置參考
  6. mac USB串口工具配置
  7. pyquery模块
  8. POJ 2263 Heavy Cargo(ZOJ 1952)
  9. [IT新应用]如何拯救死机的苹果手机(iPhone X)
  10. 2018.11.23-day25 面向对象-封装