It's a well known fact that steel swords to trade for a steel bar in today's economy.
However, the dwarven blood runs deep in steel bars. He will smith these into swords and trade them for more steel bars until he has neither steel bars left nor enough steel swords to trade for steel bars, after which he will turn to his true calling of being a programmer.
From the moment when steel bars until he becomes a programmer, how many steel swords will he smith in total?
Input Specification
The first line of input will contain one integer
, the number of steel bars starts out with.
The second line of input will contain one integer
, the exchange rate for steel swords to steel bars.
Output Specification
Output one integer, the number of steel swords
smiths.Sample Input
25
5
Sample Output
31
Explanation for Sample Output
swords from
bars, which he trades for
more bars. He then smiths
more swords, which he trades for
more bar. He smiths his last sword and is finished, having smithed a total of
swords.
Comments
I keep getting 70/100. Can someone have a look at my code please?
Try this test case:
The correct answer is 9.
Not Stonks
wheres the profit in this lol