Pagini recente » Cod sursa (job #1790765) | Cod sursa (job #2050191) | Cod sursa (job #807218) | Cod sursa (job #1728114) | Cod sursa (job #1799745)
#include <iostream>
using namespace std;
void xf(int x, int &c) // x = (5 ^ c) * ...
{
c=0;
while (x % 5 == 0)
{
c++;
x=x/5;
}
}
main()
{
int nz,zr=0,fc=0,x; // nz - numarul de zerouri, fc - x! = 5^fc * ?, zr - zerourile lui x factorial
cin >> nz;
for (x=1; zr<=nz; x++)
{
xf(x,fc);
if (zr+fc>nz)
{
cout << -1;
zr=nz+1;
}
else
if (zr+fc==nz)
{
cout << x ;
zr = nz + 1;
}
else zr+=fc;
}
}