Pagini recente » Cod sursa (job #2418997) | Cod sursa (job #1367124) | Cod sursa (job #1261288) | Cod sursa (job #2718769) | Cod sursa (job #2471234)
#include <iostream>
#include <fstream>
using namespace std;
long verf(long n)
{
long rez=0;
while(n)
{
rez=rez+n/5;
n=n/5;
}
return rez;
}
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
long long p,i,gasit=0,nr,x;
f>>p;
nr=p;
if(p==0)
g<<1;
else
{
while(gasit==0)
{
nr++;
if(verf(nr)==p)
{
x=nr;
gasit=1;
}
}
if(gasit==1)
g<<x;
else
g<<-1;
}
return 0;
}