题目链接:?space=1&num=1820
1820. Ural Steaks
Time limit: 0.5 secondMemory limit: 64 MB
After the personal contest, happy but hungry programmers dropped into the restaurant “Ural Steaks” and orderednspecialty 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 mostksteaks can be cooked simultaneously. Find the time the chef needs to cook the steaks.
Input
The only input line contains the integersnandkseparated with a space (1 ≤n,k≤ 1000).
Output
Output the minimal number of minutes in which the chef can cooknsteaks.
Sample
inputoutput
3 23
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;}
,偶尔因高山流水的美丽停留,