I TRIED USING RECURSION
I HAVE PASSED ALL THE TEST CASES STILL WA
BELOW IS MY CODE
THE RECURSION FUNCTION IS SUPPOSED TO RETURN MAXIMUM AMERICAN DOLLARS FOR THE COIN IN HAND
#include <iostream>
using namespace std;
#define ll long long
ll int mad(ll int n);
int main()
{
int t;
cin>>t;
while(t--)
{
ll int n;
cin>>n;
cout<<mad(n)<<endl;
}
return 0;
}
ll int mad(ll int n)
{
if(n==1)
{
return 1;
}
if(n==2)
{
return 2;
}
if(n==0)
{
return 0;
}
if(mad(n/2)+mad(n/3)+mad(n/4)>n)
{
return mad(n/2)+mad(n/3)+mad(n/4);
}
else
{
return n;
}
}