CodeForces - 799A Carrot Cakes(思维)

Carrot Cakes

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 6 minutes the first oven bakes 4cakes, 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,分别代表你需要的蛋糕数量, 制作 k 个蛋糕需要的时间为 t , 制作一个新的烤蛋糕的烤箱需要 d 分钟,最多制作一个。问你最后这个新制作的烤箱是否能够用得上。。。 用得上就输入 YES,反之 NO。

思路:这个题感觉很毒瘤,t 时间内做 k 个蛋糕,不能将 k 个蛋糕分开来算,也就是说 如样例2,8 6 4 6,在第6秒的时候,新的烤炉已经制作好了,但是剩下4 块蛋糕,而正好一个烤炉正好能够制作4个蛋糕,所以。。。新的烤炉就没用了,。。

只需要计算一下  制作新烤炉之前以 k 为单位产生的蛋糕数量,然后判断一下剩下需要蛋糕的数量是否能够用到新烤箱就行了。。。,

AC代码:

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,t,k,d;
    while(~scanf("%d%d%d%d",&n,&t,&k,&d)){  //d 是时间
        int tim = ceil(n * 1.0 / k) * t;
        int dt = floor(d * 1.0 / t) * k;
        int lef = n - dt;
        if(lef > k)
            puts("YES");
        else puts("NO");
    }
    return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值