Hello all,
I tried to submit this FCTRL4 problem on SPOJ..Its giving me right
answer in my system,but I'm getiing SIGSEV runtime error when I
submit.Here's my code.plz lemme know if there's anything wrong and
also any optimizations.
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int a[200];
int main()
{
int N,x,i,no,m,temp,k;
while(1)
{
scanf("%d",&N);
if(N==EOF)
exit(0);
a[0]=1;
m=1;
i=1;
while(i<=N)
{
k=0;
temp=0;
while(k<m)
{
x=a[k]*i+temp;
a[k]=x%10;
temp=x/10;
k++;
}
while(temp!=0)
{
m++;
a[m-1]=temp%10;
temp/=10;
}
i++;
}
for(int j=0;j<=m-1;j++)
if(a[j]!=0)
{
printf("%d",a[j]);
break;
}
printf("\n");
}
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.