A10904 | Carrot Cakes
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
The only line contains four integers $n$ , $t$ , $k$ , $d$ ( $1<=n,t,k,d<=1000$ ) — 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.
输出格式
If it is reasonable to build the second oven, print "YES". Otherwise print "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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted