Pagini recente » Cod sursa (job #140921) | Cod sursa (job #73374) | Cod sursa (job #1933301) | Cod sursa (job #1897570) | Cod sursa (job #546586)
Cod sursa(job #546586)
#include<iostream.h>
#include<fstream.h>
int main()
{
ifstream f;
f.open("fact.in");
ofstream g;
g.open("fact.out");
int l=0, p;
f>>p;
int aux,n,i;
int ok=1;
aux=5*p;
i=aux;
while (ok)
{ n=0;
aux=i;
while(aux!=0)
{
aux/=5;
n=n+aux;
}
if (n==p) ok=0;
else i-=5;
}
if (p==0) g<<"1";
else if (n==p) g<<i;
else g<<"-1";
f.close();
g.close();
return 0;
}