Hello All
I have been getting wrong answer continuously for the following code please help me out in fixing the bugs
Problem COINS Problem - CodeChef
include
using namespace std;
typedef unsigned long long int ull;
unsigned long long func(unsigned long long x)
{
ull s=0;
ull a,b,c;
a=x/2;
b=x/3;
c=x/4;
if(a>=12)
s=s+func(a);
else
s=s+a;
if(b>=12)
s=s+func(b);
else
s=s+b;
if(c>=12)
s=s+func(c);
else
s=s+c;
return s;
}
int main()
{
ull n[10],max;
int i,j;
cin>>j;
for(i=0;i<j;i++)
{
cin>>n[i];
max=func(n[i]);
if(max<n[i])
cout<<n[i]<<endl;
else
cout<<max<<endl;
}
return 0;
}