 TRYAGAIN - Editorial

Author: Yash Shah
Tester: Roshan Gupta, Shivam Sarang, Hrishikesh Patel
Editorialist: Yash Shah

EASY-MEDIUM

PROBLEM:

There is a country where integer N is written on coin. A coin with
integer N on it can be exchanged in a bank into three coins: N/2, N/3
and N/4. But these numbers are all rounded down (the banks have to
make a profit).

You can also sell coins for American Dollars. The exchange rate is
1:1. But you cannot buy coins through American Dollars.

You have one coinwhich has N written on it. What is the maximum
amount of American dollars you can get for it?

Note: You are not provided with total number of test cases. The first
line itself is N.

Input Format:

• The input will contain several test cases.
• Each testcase is a single line with a number N. It is the number

Output Format:

• For each test case output a single line, containing the maximum
amount of American dollars you can make.

EXPLANATION:

Sample Test Case:

Input:
12
2

Output:
13
2

• Test Case 1: You can change 12 into 6, 4 and 3, and then change
these into 6+6+4+3=3=13.
• Test Case 2: If you try changing the coin 2 into 3 smaller coins,
you will get 1, 0 and 0, and later you can get no more than 1 out of
them. It is better just to change the 2 coin directly into 2.

SOLUTIONS:

Setter's Solution
while True:
try:
n = int(input())
lst = [int(n / i) for i in [2, 3, 4]]
print(max(n, sum(lst)))
except:
break