FCTRL Time Help

exceeded
fctrl
time

#1

`#include<stdio.h>
#include<stdlib.h>
inline void scanint(long int *a)
{
char c = 0;
while(c<33)
//c = fgetc_unlocked(stdin);
c = getc(stdin);
*a = 0;
while(c>33)
{
*a = (*a)*10 + c - ‘0’;
//c = fgetc_unlocked(stdin);
c = getc(stdin);
}
}

void fact(long int n, long int*fi, long int *tw)
{ int i;
int t;
t=n;
while(n%5==0)
{
(*fi)++;
n/=5;
}
while(t%2==0)
{
(*tw)++;
t/=2;
}
}

int main()
{long int x,t;
long int *a;
scanint(&x);
a=(long int *)calloc(x,sizeof(long int));

t=x;
long int k;
while(x)
{ long int fi=0,tw=0;
long int i,n;
scanint(&n);
for(i=5;i<=n;i++)
{fact(i,&fi,&tw);
}
x–;
a[x]=(fi<tw)?fi:tw;
}
for(k=t-1;k>=0;k–)
printf("%ld
",a[k]);
return 0;
}
`Can anybody help me optimise the time required further. Thank you in advance.