Cod sursa(job #113384)
| Utilizator | Data | 9 decembrie 2007 20:37:41 | |
|---|---|---|---|
| Problema | Factorial | Scor | 35 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.6 kb |
#include<stdio.h>
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
long int i,j,p,k;
int t=1;
j=0;
scanf("%ld",&p);
//if (p==0)
// {
// printf("1");
// return 0;
// }
for (i=0;i<100000000;i=i+5)
{
k=i+t;
t=0;
while (k%5==0)
{
j++;
k/=5;
}
if (p==j)
{
printf("%ld",i);
return 0;
}
if (j>p)
{
if (j>p)
{
printf("1");
return 0;
}
printf("-1");
return 0;
}
}
//if (gasit==1)
// printf("-1");
//fclose(stdin);
//fclose(stdout);
return 0;
}
