Magic Pocket SOLUTIONS SC_04 CODECHEF
Harry Potter has one roll and zero rupee in his pocket. He will play out the accompanying activities precisely K times altogether, in the request he prefers:
Hit his pocket, which mysteriously expands the quantity of bread rolls by one.
Trade A scones to 1 rupee.
Trade 1 rupee to B scones.
Locate the greatest conceivable number of scones in Harry’s pocket after K tasks.
Info is given in the accompanying organization:
K A B
Prit the greatest conceivable number of scones in Harry’s pocket after Koperations.
K, An and are numbers.
4 2 6
The quantity of scones in Harry’s pocket after K activities is amplified as follows:
Hit his pocket. Presently he has 2 scones and 0 rupee.
Trade 2 scones to 1 rupee in his pocket .Now he has 0 rolls and 1 rupee.
Hit his pocket. Presently he has 1 scones and 1 rupee.
Trade 1 rupee to 6 bread rolls. his pocket. Presently he has 7 rolls and 0 rupee.