Cod sursa(job #113854)
Utilizator | Data | 11 decembrie 2007 19:54:46 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<stdio.h>
#include<math.h>
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
long int p,i,j,k;
j=0;
scanf("%ld",&p);
if (p==0)
{
printf("1");
return 0;
}
for (i=0;i<100000000;i=i+5)
{
k=i;
while (k%5==0 && i!=0)
{
j++;
k/=5;
}
if (j>p)
{
printf("-1");
return 0;
}
if (p==j)
{
printf("%ld",i);
return 0;
}
return 0;
}