Cod sursa(job #138896)
Utilizator | Data | 19 februarie 2008 14:20:02 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<iostream.h>
#include<stdio.h>
void main ()
{int N,n=0,N2,truth=-1;
long long P;
freopen ("fact.in", "rt" ,stdin);
freopen ("fact.out","wt" ,stdout);
scanf("%d",&P);
if (P==0) N=6;
else for (N=5;n<P;N=N+5) {N2=N;
while (N2%5==0) {N2=N2/5;
n++;}}
if (n>P) printf("%d",truth);
if (n==P) printf("%d",N-5);}