URAL 1820. Ural Steaks
来源:互联网 发布:教学软件介绍 编辑:程序博客网 时间:2024/06/06 04:49
1820. Ural Steaks
Time limit: 0.5 second
Memory limit: 64 MB
Memory limit: 64 MB
After the personal contest, happy but hungry programmers dropped into the restaurant “Ural Steaks” and ordered n specialty steaks. Each steak is cooked by frying each of its sides on a frying pan for one minute.
Unfortunately, the chef has only one frying pan, on which at most k steaks can be cooked simultaneously. Find the time the chef needs to cook the steaks.
Input
The only input line contains the integers n and k separated with a space (1 ≤ n, k ≤ 1000).
Output
Output the minimal number of minutes in which the chef can cook n steaks.
Sample
3 2
3
用最短的时间内煎牛排,算法个人觉得不是很好想。
如果n小于等于k的话就很好办了,2分钟就可以煎完。
n大于k时,如果2*n%k=0的话,2*n/k的时间就可以全部完成;如果不等于0的话就在2*n/k的基础上加1就行了。
#include <cstdio>#include <iostream>using namespace std;int main(){ int n,k,t,m; while(cin>>n>>k) { t=2*n/k; m=2*n%k; if(n<=k) cout<<2<<endl; else{ if(m==0) cout<<t<<endl; else cout<<t+1<<endl; } } return 0;}
0 0
- URAL 1820. Ural Steaks
- ural 1820. Ural Steaks 贪心
- Timus 1820. Ural Steaks
- URAL 1820. Ural Steaks(数学啊 )
- ural 1820. Ural Steaks -思维题
- Timus 1820. Ural Steaks 题解
- Timus Online Judge:1820. Ural Steaks
- URAL 1820 Ural Steaks (贪心)
- URAL - 1820 Ural Steaks(小学生题)
- URAL
- 【ural】
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- $parent属性
- Java面试题
- Dev GridView RowCellClick事件与MouseDown事件
- 对于递归调用的理解
- xamarin.forms Vibrate Plugin震动操作
- URAL 1820. Ural Steaks
- 冒泡排序
- navicat for my sql 过期问题
- Eclipse中10个最有用的快捷键组合
- xamarin.forms 位置访问和通讯录访问和拍照加图片,的操作(推荐)
- P2P技术
- 黑马基础测试题(一)
- instanceof关键字
- Nodejs连接MySQL&&实现unity中的登陆注册功能