URAL 1820. Ural Steaks(数学啊 )

题目链接:

space=1&num=1820" target="_blank">http://acm.timus.ru/problem.aspx?

space=1&num=1820

1820. Ural Steaks

Time limit: 0.5 second

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 ≤ nk ≤ 1000).

Output

Output the minimal number of minutes in which the chef can cook n steaks.

Sample

input output
3 2
3

PS:

选择尽快先炸掉每块牛排的当中一个面!

对于案例:

第一步:a1, b1;

第二步:c1, a2;

第三步:b2, c2;

代码例如以下:

#include <cstdio>
#include <cstring> int main()
{
int n, k;
while(~scanf("%d%d",&n,&k))
{
if(n < k)
{
printf("2\n");
continue;
}
int tt = (2*n)%k;
int ans = 2*n/k;
if(tt)
{
ans+=1;
}
printf("%d\n",ans);
}
return 0;
}
上一篇:Jmeter 发送json{Jfinal 接口req rsp均为json}


下一篇:Django中的CBV视图