CF799A.Carrot Cakes

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

在 Playrix 公司开发的某款游戏中,一台烤箱需要 tt 分钟来烘烤 kk 个胡萝卜蛋糕,所有蛋糕均在开始烘烤后的第 tt 分钟同时完成。Arkady 完成某项任务至少需要 nn 个蛋糕,但他目前一个也没有。不过,他拥有无限的原料以及一台烤箱。此外,Arkady 还可以建造一台相同的额外烤箱以加快制作进程,但建造这台新烤箱需要 dd 分钟。在新烤箱建造期间,仅能使用原有的烤箱烘烤蛋糕;新烤箱建成后,两台烤箱可同时工作。Arkady 最多只能建造一台额外烤箱。

请判断建造第二台烤箱是否合理,即:它能否减少获得 nn 个蛋糕所需的最短时间。若使用第二台烤箱所需时间与仅使用一台烤箱相同,则视为不合理。

输入格式

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

唯一的一行包含四个整数 nn、tt、kk、dd(1 ≤ n, t, k, d ≤ 1 0001 ≤ n, t, k, d ≤ 1 000)——分别表示所需蛋糕数量、一台烤箱烘烤 kk 个蛋糕所需的时间、单次可同时烘烤的蛋糕数量、建造第二台烤箱所需的时间。

输出格式

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

如果建造第二台烤箱是合理的,则输出 “YES”;否则输出 “NO”。

输入输出样例

  • 输入#1

    8 6 4 5

    输出#1

    YES
  • 输入#2

    8 6 4 6

    输出#2

    NO
  • 输入#3

    10 3 11 4

    输出#3

    NO
  • 输入#4

    4 2 1 4

    输出#4

    YES

说明/提示

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

在第一个例子中,使用一台烤箱可在 12 分钟内烤出 8 个蛋糕。第二台烤箱可在 5 分钟内建成,因此在第 6 分钟时,第一台烤箱已烤出 4 个蛋糕;第二台烤箱在第 11 分钟时又额外烤出 4 个蛋糕。因此,建造第二台烤箱是合理的。

在第二个例子中,无论是否建造第二台烤箱,结果均相同:均需 12 分钟烤出 8 个蛋糕。因此,建造第二台烤箱是不合理的。

在第三个例子中,第一台烤箱仅用 3 分钟即可烤出 11 个蛋糕,已超过所需的 10 个。建造第二台烤箱是不合理的,因为其建造耗时超过了仅用一台烤箱烤出所需数量蛋糕所花费的时间。

输入解题思路,AI测评打分。不知道怎么写?

首页