DWITE, November 2012, Problem 1
After collecting all the candy you could get at Halloween, you decided to eat all of that candy as fast as possible! However, after having eaten some of them you get a sugar rush, enabling you to eat the remaining pieces even faster! Before starting, you want to calculate how long it will take you to eat all of your candy. From previous Halloweens, you noticed that you start eating one piece of candy at a time (i.e. one piece per mouthful). However, after having eaten pieces, the sugar rush kicks in and you can eat twice as many pieces of candy at a time. Then after having eaten another pieces, the amount you can eat at a time is doubled yet again! This continues until you finish all of your candy!
Note: you can only get one sugar rush at a time, even if you eat pieces of candy in one go.
The input will contain 5 test cases. Each test case is a line with two integers, , representing the number of pieces of candy you have and the count of pieces necessary for the sugar rush respectively.
The output will contain 5 lines of output. Each a single integer — the minimum number of mouthfuls necessary to eat all pieces of candy, in each of the test cases.
10 1 10 5