I dint understand money exchange problem please explain

Tughlaq introduces a strange monetary system. He introduces copper coins and each coin has a number written on it. A coin n can be exchanged in a bank into three coins: n/2, n/3 and n/4. A coin can also be sold for gold. One can get as much grams of gold as the number written on the coin. You have one copper coin. What is the maximum weight of gold one can get from it?

Input Format
The input file contains a single integer n, the number on the coin.

Constraints
0 <= n <= 1 000 000 000

Output Format
Print the maximum weight of gold you can get.

Sample Input
12
Sample Output
13

for 12 you go to bank exchange it into 6 4 3
now you can get 6+4+3=13 gram of gold

so that the ans

what will be ans of 15 ?

for 15 you get exchange of 7 5 3
7+5+3=15
so ans is 15

#include
//#define int long long int
using namespace std;
int main() {
long long int n;
cin>>n;
cout<<(n/2)+(n/3)+(n/4)<<endl;

}

is it correct code for this problem :grinning::grinning:

no, it is not that simple
because if n is much greater no and when you get exchange of it then it is also possible that
you can get more gold by exchanging those coins further
means
if n=100
you get 50 33 25 now you can get more gold from 50

try to use it using recursion

does my logic is wrong ??


if yes please suggest me algo of this problem
@Saurabh2