Thursday, October 2, 2014

ACM 1820. Ural Steaks / Уральские бифштексы

Steaks are 2 sided so we need to consider them as 2n sides which need to be cooked and we have a pan which can hold up to k sides. It will be stupid to leave a spot in k empty if there are some sides left, so basically the answer will be 2n/k rounded up ( we fry full k sides until we are down to some remainder which is smaller than k and also take 2 more minutes to fry the final steaks). But this formula doesn't work when we have 2*n<k initially, In this case the answer is 2 which need sot be handled separately.


       FULL SOURCE CODE 

No comments:

Post a Comment