Pagini recente » Cod sursa (job #2382219) | Cod sursa (job #2136011) | Cod sursa (job #1024059) | Cod sursa (job #590797) | Cod sursa (job #1779342)
#include <iostream>
#include <fstream>
using namespace std;
long long n,nr=0,x,y;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>n;
if (n==0) {g<<1; return 0;}
x=n*5;
while (nr!=n)
{
nr=0;
for (int i=5;i<=x;i+=5)
{
y=i;
while (y%5==0)
{
nr++;
y=y/5;
}
}
if (nr>n) x=x-5;
else if (nr==n) {g<<x; return 0;}
else {g<<-1; return 0;}
}
return 0;
}