Hi everyone, time for the next monthly contest. The rules are the same as before. Due date for all of these problems is May 15th. Due to popular demand, the problem difficulty has been scaled down a bit, but there is still an easy, medium, and hard problem. If you have any questions, please post in this thread instead of PMing me, that way anyone else who might have had the same question can see the answer. PM me with your code. Have fun and good luck!
You are a cook during rush hour at a fast food restaurant. To cook a hamburger thoroughly, you must fry each side for five minutes. These five minutes do not have to happen concurrently so you can fry one side, let it sit for awhile off to the burner, then cook the other side at your leisure.
Now, given the maximum number of hamburgers you can fit on your frying pan and the total number of hamburgers to cook, what is the minimum amount of minutes to cook all of the hamburgers thoroughly?
Your function will have this format:
int fryBurgers(int panSize, int numHamburgers)
- Pan size will be the number of hamburgers the pan can fit and will be between 1 and 1000
- Number of hamburgers will be between 0 and 1000
- fryHamburgers(2,3) will return 15
Call the hamburgers 1, 2, and 3. Cook hamburger 1 and 2 for 5 minutes. Take hamburger 1 off the pan and add hamburger 3 and flip hamburger 2. Cook for 5 minutes. Flip hamburger 3 and replace hamburger 2 with flip side of hamburger 1. Cook for 5 minutes. 15 minutes total and all 3 are cooked.
- fryHamburgers(100,1) will return 10
Big pan but only need to cook one burger. Cook one side for 5 minutes then cook other side for 5 minutes.
- fryHamburgers(303,919) will return 35