Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Jojo likes honey, so he has many bottles that are still full of honey

Jojo likes honey, so he has many bottles that are still full of honey

Computer Science

Jojo likes honey, so he has many bottles that are still full of honey. In his country, there is a regulation stating that one can exchange B empty bottles of honey for 1 new bottle of honey. Now he wonders, how many bottles of honey can he drink if at first he has A full bottles of honey and he always acts optimally in exchanging his empty honey bottle? Help him answer his question. Format Input The first line is an integer T which shows the number of test cases. For each test case, there will be 1 line consisting of 2 integers A and B representing the number of full honey bottles that Jojo had in the beginning, and the number of empty honey bottles needed in exchange for 1 new bottle of honey. Format Output For each test case, output 1 line in the form of "Case #X: Y". X is the number of test cases, and Y is the total amount of honey in bottles that Jojo can drink maximally. Constraints • 1 ≤ T ≤ 100 • 2 ≤ A, B ≤ 10000 Sample Input 1 (standard input) 1 4 2 Sample Output 1 (standard output) Case #1: 7 Sample Input 2 (standard input) 1 Sample Output 2 (standard output) Case #1: 5 Note = In the second sample test case, Jojo has 3 bottles of honey in the beginning. After he drinks all of them, he has 3 empty bottles. He exchanges 2 empty bottles into 1 new bottle of honey. Now he has 1 new bottle of honey and 1 empty bottle of honey. He drinks 1 new bottle of honey so now he has drunk a total of 4 bottles of honey and still has 2 empty bottles left. Then, he exchanges 2 empty bottles into 1 new bottle of honey, then drinks it, so he now has drunk a total of 5 bottles of honey and now he has 1 empty bottle left that is not enough to be exchanged again. 

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE