English · Original
Chinese · Translation
Formal · Original
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 _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.
## Output
If it is reasonable to build the second oven, print "_YES_". Otherwise print "_NO_".
[samples]
## 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 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.
在 Playrix 的某个游戏中,一个烤箱需要 #cf_span[t] 分钟来烤出 #cf_span[k] 个胡萝卜蛋糕,所有蛋糕会在开始烘焙后 #cf_span[t] 分钟同时完成。Arkady 需要至少 #cf_span[n] 个蛋糕来完成任务,但他目前一个都没有。然而,他拥有无限的原料和一个烤箱。此外,Arkady 可以建造一个类似的额外烤箱以加快进程,建造这个烤箱需要 #cf_span[d] 分钟。在新烤箱建造期间,只有旧烤箱可以烘焙蛋糕;新烤箱建成后,两个烤箱将同时工作。Arkady 不能建造超过一个烤箱。
请判断建造第二个烤箱是否合理,即是否会减少获得 #cf_span[n] 个蛋糕所需的最少时间。如果使用第二个烤箱所需的时间与仅使用一个烤箱相同,则视为不合理。
仅一行包含四个整数 #cf_span[n], #cf_span[t], #cf_span[k], #cf_span[d](#cf_span[1 ≤ n, t, k, d ≤ 1 000])——分别表示所需蛋糕数量、一个烤箱烤出 #cf_span[k] 个蛋糕所需时间、每次同时烘焙的蛋糕数、建造第二个烤箱所需时间。
如果建造第二个烤箱是合理的,请输出 "_YES_";否则输出 "_NO_"。
在第一个示例中,使用一个烤箱可以在 #cf_span[12] 分钟内获得 #cf_span[8] 个蛋糕。第二个烤箱可以在 #cf_span[5] 分钟内建成,因此在 #cf_span[6] 分钟时,第一个烤箱烤出了 #cf_span[4] 个蛋糕;在 #cf_span[11] 分钟时,第二个烤箱烤出了另外 #cf_span[4] 个蛋糕。因此,建造第二个烤箱是合理的。
在第二个示例中,无论是否建造第二个烤箱,都需要 #cf_span[12] 分钟才能烤出 #cf_span[8] 个蛋糕,因此建造第二个烤箱是不合理的。
在第三个示例中,第一个烤箱在 #cf_span[3] 分钟内烤出了 #cf_span[11] 个蛋糕,已经超过所需的 #cf_span[10] 个。由于建造第二个烤箱所需时间比仅用一个烤箱烤出所需蛋糕的时间还长,因此建造第二个烤箱是不合理的。
## Input
仅一行包含四个整数 #cf_span[n], #cf_span[t], #cf_span[k], #cf_span[d](#cf_span[1 ≤ n, t, k, d ≤ 1 000])——分别表示所需蛋糕数量、一个烤箱烤出 #cf_span[k] 个蛋糕所需时间、每次同时烘焙的蛋糕数、建造第二个烤箱所需时间。
## Output
如果建造第二个烤箱是合理的,请输出 "_YES_";否则输出 "_NO_"。
[samples]
## Note
在第一个示例中,使用一个烤箱可以在 #cf_span[12] 分钟内获得 #cf_span[8] 个蛋糕。第二个烤箱可以在 #cf_span[5] 分钟内建成,因此在 #cf_span[6] 分钟时,第一个烤箱烤出了 #cf_span[4] 个蛋糕;在 #cf_span[11] 分钟时,第二个烤箱烤出了另外 #cf_span[4] 个蛋糕。因此,建造第二个烤箱是合理的。在第二个示例中,无论是否建造第二个烤箱,都需要 #cf_span[12] 分钟才能烤出 #cf_span[8] 个蛋糕,因此建造第二个烤箱是不合理的。在第三个示例中,第一个烤箱在 #cf_span[3] 分钟内烤出了 #cf_span[11] 个蛋糕,已经超过所需的 #cf_span[10] 个。由于建造第二个烤箱所需时间比仅用一个烤箱烤出所需蛋糕的时间还长,因此建造第二个烤箱是不合理的。
**Definitions**
Let $ n, t, k, d \in \mathbb{Z}^+ $ denote:
- $ n $: minimum number of cakes required,
- $ t $: time (minutes) for one oven to bake $ k $ cakes,
- $ k $: number of cakes baked per batch by one oven,
- $ d $: time (minutes) to build a second identical oven.
**Constraints**
$ 1 \leq n, t, k, d \leq 1000 $
**Objective**
Let $ T_1 $ be the minimum time to produce at least $ n $ cakes using only one oven:
$$
T_1 = t \cdot \left\lceil \frac{n}{k} \right\rceil
$$
Let $ T_2 $ be the minimum time to produce at least $ n $ cakes using two ovens, where the second oven becomes operational after $ d $ minutes:
$$
T_2 = \min \left\{ T \geq d \ \middle|\ \left\lfloor \frac{T}{t} \right\rfloor \cdot k + \left\lfloor \frac{T - d}{t} \right\rfloor \cdot k \geq n \right\}
$$
(If $ T < d $, then only the first oven is active: $ \left\lfloor \frac{T}{t} \right\rfloor \cdot k \geq n $, but since $ T_2 \geq d $, this case is irrelevant.)
**Decision Rule**
Output "YES" if $ T_2 < T_1 $; otherwise output "NO".
API Response (JSON)
{
"problem": {
"name": "A. Carrot Cakes",
"description": {
"content": "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 comp",
"description_type": "Markdown"
},
"platform": "Codeforces",
"limit": {
"time_limit": 1000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "CF799A"
},
"statements": [
{
"statement_type": "Markdown",
"content": "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 comp...",
"is_translate": false,
"language": "English"
},
{
"statement_type": "Markdown",
"content": "在 Playrix 的某个游戏中,一个烤箱需要 #cf_span[t] 分钟来烤出 #cf_span[k] 个胡萝卜蛋糕,所有蛋糕会在开始烘焙后 #cf_span[t] 分钟同时完成。Arkady 需要至少 #cf_span[n] 个蛋糕来完成任务,但他目前一个都没有。然而,他拥有无限的原料和一个烤箱。此外,Arkady 可以建造一个类似的额外烤箱以加快进程,建造这个烤箱需要 #cf_span[d...",
"is_translate": true,
"language": "Chinese"
},
{
"statement_type": "Markdown",
"content": "**Definitions** \nLet $ n, t, k, d \\in \\mathbb{Z}^+ $ denote: \n- $ n $: minimum number of cakes required, \n- $ t $: time (minutes) for one oven to bake $ k $ cakes, \n- $ k $: number of cakes baked ...",
"is_translate": false,
"language": "Formal"
}
]
}