链接:https://ac.nowcoder.com/acm/contest/13324/M 来源:牛客网
In China, there is a very famous problem about pancakes: You have a
pan and you can fry two pancakes at the same time each time. For a
pancake, its front and back sides need to be cooked, and it takes one
hour for each side to be cooked.So how long does it take at least to cook 3 pancakes? The answer is
three hours:In the first hour, fry the front of No.1 pancake and the front of No.2
pancake.In the second hour, fry the back of No.2 pancake and the front of No.3
pancake.In the third hour, fry the back of No.1 pancake and the back of No.3
pancake.Now you have a pan and you can fry KK pancakes at the same time each
time. How many hours does it takes at least to cook NN pancakes?It’s noticed that you have to fry some side of the pancake until fully
cooked every time, it means that you can’t fry some side of the
pancake half-cooked and taking it out. So the answers are always
integers.
题意:一次能够煎k面,现在有n个煎饼一个煎饼有2个面,煎一面要花费一个小时,求花费的最小时间。
这个题是一道水题,放在了最后位置。。。
就是有2*n个面一次煎k面,求次数。
int main()
{
int N,K;
scanf("%d%d",&N,&K);
cout<<((N<=K)?2:(2*N/K)+bool(2*N%K))<<endl;
}