Codeforces Round #413 Div. 1 + Div. 2 A. Carrot Cakes
来源:互联网 发布:手机 Ubuntu 编辑:程序博客网 时间:2024/06/08 10:54
Codeforces Round #413 Div. 1 + Div. 2 A. Carrot Cakes
A. Carrot Cakes
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
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”.
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
题解 :
先算出第一台所需要的总时间
然后计算第二台 产生并且做出一次 的总时间
#include <stdio.h>#include <bits/stdc++.h>using namespace std;int n,t,k,d;int main(){ cin>>n>>t>>k>>d; int p1=n/k+(n%k==0?0:1); p1*=t; int p2=d+t; if(p2<p1) cout<<"YES"; else cout<<"NO"; return 0;}
- Codeforces Round #413 Div. 1 + Div. 2 A. Carrot Cakes
- codeforces Round #413 Div. 1 + Div. 2 A Carrot Cakes
- codeforces Round #413 Div. 1 + Div. 2 A Carrot Cakes
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) A. Carrot Cakes
- Codeforces Round #414, rated, Div. 1 + Div. 2 B. Cutting Carrot+【等腰三角形等比例缩小】
- (Codeforces Round #413, rated, Div. 1 + Div. 2)(A+B)
- Codeforces 799A Carrot Cakes 题解
- Codeforces Round #413(Div. 1 + Div. 2)
- Codeforces Round #230 (Div. 2) C / (Div. 1) A
- codeforcesPlayrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2)A题
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) A题
- Codeforces Round #167 (Div. 2 && Div.1)
- Codeforces Round #185 (Div. 1) && (Div. 2)
- Codeforces Round #166 (Div. 1) && (Div. 2)
- Codeforces Round #292 (Div. 2 Div. 1)
- A. Carrot Cakes Codeforce 思维
- Codeforces Round #413 Div. 1 + Div. 2 C. Fountains
- codeforces Round #413 Div. 1 + Div. 2 C Fountains
- base64
- Netty学习之三--Java I/O模型
- 原型模式
- Intent 传递对象 Serializable/Parcelable
- 起步-封装组件
- Codeforces Round #413 Div. 1 + Div. 2 A. Carrot Cakes
- Oracle
- [robot]Quaternions and Rigid Transformations
- 启动活动的最佳写法
- js运动--同时运动框架
- 【C++后台开发面试】C++语言相关
- Spyder使用和调试方法
- 使用 `text-align:justify;` 实现横栏自适应布局
- Oracle(PL/SQL编程基础(PL/SQL程序块与PL/SQL语句)、异常、游标、数据类型)