Cod sursa(job #687128)
Utilizator | Data | 22 februarie 2012 09:25:40 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<stdio.h>
using namespace std;
long v[100000000];
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
long int i=0,y,x;
while(i<=100000000)
{
y=i/5;
x=y;
while(y>0)
{
y=y/5;
x=x+y;
}
v[x]=i;
i=i+5;
}
long int P;
scanf("%ld",&P);
if(v[P]!=0)printf("%ld",v[P]);
else if(P==0)printf("0");
else printf("-1");
return 0;
}