codeforcesPlayrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2)A题
来源:互联网 发布:java zip打包下载 编辑:程序博客网 时间:2024/05/21 11:14
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.
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.
If it is reasonable to build the second oven, print "YES". Otherwise print "NO".
8 6 4 5
YES
8 6 4 6
NO
10 3 11 4
NO
4 2 1 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 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.
//1.看我们先造完还是第一个先烤完//2.若只剩下一个,手动给第一个oven烤,剩下不足k个也给第一个//3.n要减一的目的:若恰好是前n-k个烤完时间恰好为d则再来k个也不需要多一个oven//续3:若是不减一答案不同 第二个点就是 #include<bits/stdc++.h>using namespace std;int main(){int n,k,t,d;//1.看我们先造完还是第一个先烤完//2.若只剩下一个,手动给第一个oven烤,剩下不足k个也给第一个//3.n要减一的目的:若恰好是前n-k个烤完时间恰好为d则再来k个也不需要多一个oven//续3:若是不减一答案不同 第二个点就是 scanf("%d%d%d%d",&n,&t,&k,&d);if(d<(n-1)/k*t) puts("YES");else puts("NO"); }
题意很坑,他是可以边造边烤的。
- codeforcesPlayrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2)A题
- CodeforcesPlayrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2)C题C. Fountains
- codeforcesPlayrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2)B题B. T-shirt buying
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) A题
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) A. Carrot Cakes
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C. Fountains(树状数组)
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C Fountains 乱搞
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C Fountains
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) B. T-shirt buying
- [Updating] Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) 解题报告
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) B
- (Codeforces Round #413, rated, Div. 1 + Div. 2)(A+B)
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) A -- D
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) A. Vicious Keyboard
- Codeforces Round #423 (Div. 1, rated, based on VK Cup Finals) A 题目忘了
- Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1)
- Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) 菜鸡只会ABC!
- Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1)
- 1095: 大小写转换
- 机器学习学习笔记(二)
- 基于RPC原理的dubbo
- Eclipse+MySQL(利用docker虚拟技术)实现本地部署
- 数据结构(5)之哈希表
- codeforcesPlayrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2)A题
- SharedPreferences 的注意事项
- 数据结构(6)之二叉树
- 1055 气球
- Java 中 String 类的常用方法
- Linux命令基础15-top命令
- 内联函数的意义和使用
- Linux 命令之系统管理(长期维护)
- 红黑树与AVL树