Cod sursa(job #134364)
Utilizator | Data | 11 februarie 2008 16:15:21 | |
---|---|---|---|
Problema | Factorial | Scor | 60 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include<stdio.h>
int main()
{long int p,c=0,i,n;
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%ld",&p);
i=0;
if(p==0)
{
printf("1");
return 0;
}
while(c<p)
{
i=i+5;
n=i;
while(n%5==0)
{
c++;
n=n/5;
}
}
if(c==p)
printf("%ld",i);
else
printf("-1");
return 0;
}