why am I getting SIGSEGV again and again...???...some1 plz help me out....
problem link --> https://www.spoj.com/problems/COINS/
submission code ::
#include<bits/stdc++.h>
using namespace std;
long long int fun(long long int );
long long int has[100000];
int main()
{
long long int a;
while(scanf("%lld",&a)!=EOF)
{
long long int r;
r=fun(a);
printf("%lld\n",r);
}
return 0;
}
long long int fun(long long int n)
{
long long int i;for(i=0;i<=12;i++){has[i]=i;}
for(i=13;i<100000;i++)
{has[n]=has[n/2]+has[n/3]+has[n/4];}
if(n<100000)
{
return(has[n]);
}
else
{
return(fun(n/2)+fun(n/3)+fun(n/3));
}
}
Asked by: ABHISHEK_KUMAR2 on April 7, 2019, 6:34 p.m. Last updated on April 7, 2019, 6:34 p.m.