Cod sursa(job #195647)
Utilizator | Data | 20 iunie 2008 13:54:31 | |
---|---|---|---|
Problema | Factorial | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <stdio.h>
long long i,p,z,nr;
int main()
{
freopen("fact.in","rt",stdin);
freopen("fact.out","wt",stdout);
scanf("%lld", &p);
z=i=0;
while (z<p)
{
i=i+5;
nr=i;
while (nr%5==0)
{z++;
nr/=5;
}
}
if (z>p) printf("-1");
else if (p==0) printf("1");
else printf("%lld",i);
return 0;}