Cod sursa(job #283247)
Utilizator | Data | 18 martie 2009 21:51:26 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include<stdio.h>
#include<values.h>
#include<math.h>
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
long n,i=1,a[25],q=1,p,t=MAXLONG;
scanf("%ld",&p);
a[1]=pow(5,1);
while(t>pow(5,i))
{
i++;
a[i]=pow(5,i);
}
n=10;
while(q<p)
{
i=1;
while(n%a[i]==0) { i++; q++; }
n+=5;
}
printf("%ld",n-5);
return 0;
}