Wrapper Exchange
A shop runs a promotion where you can buy chocolates with money, then exchange wrappers for more chocolates. The function chocolate_feast receives the budget n, the price of one chocolate c, and the number of wrappers m needed for one exchange. Wrappers from free chocolates also count toward future exchanges. Return the total number of chocolates eaten.
Примеры
Ввод
10, 2, 5Вывод
6Ввод
12, 4, 4Вывод
3Ввод
6, 2, 2Вывод
5Нужно реализовать
def chocolate_feast(n: int, c: int, m: int) -> int:
Теги
math
Logga in för att se historik över inskick
Logga inLogga in för att använda AI-mentorn
Logga inVisible tests
1
Input
10, 2, 5Expected
62
Input
12, 4, 4Expected
33
Input
6, 2, 2Expected
54
Input
100, 1, 100Expected
1015
Input
15, 3, 2Expected
96
Input
-1, 4, 4Expected
-1Focus radio
Paused · SomaFM · Fluid