Pagini recente » Cod sursa (job #1370454) | Cod sursa (job #159387) | Cod sursa (job #903268) | Cod sursa (job #3272480) | Cod sursa (job #138691)
Cod sursa(job #138691)
#include<iostream.h>
#include<stdio.h>
int main ()
{long long N2,c,c2;
long int P,N=0;
int truth=-1,truth2=1;
freopen ("fact.in", "rt" ,stdin);
freopen ("fact.out","wt" ,stdout);
//cin>>P;
scanf ("%ld",&P)
if (P==0) printf ("%d",truth2);
else{for (N=25,c2=1,c=6;P>=c;N=N+25,P=P-c,c2++) if (c2==5) {c2=0; c++;}
while (P>0) {N2=N;
while (N2%5) {P--;
N2=N2/5;}
N=N+5;}}
if (P<0) printf ("%d",truth);
if (P==0 && N!=0) printf ("%ld",N);
return 0;}