Pagini recente » Profil StarGold2 | Profil StarGold2 | Cod sursa (job #564079) | Cod sursa (job #1785706) | Cod sursa (job #2783497)
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int nz(long long n) {
int p = 5;
int s = 0;
while (p <= n) {
s += n / p;
p *= 5;
}
return s;
}
int main() {
int c = 5;
int p;
fin >> p;
while (nz(c) <= p) {
c += 5;
}
if (p == 0)
cout << 1;
if (nz(c) != p)
fout << -1;
else
fout << c - 5;
}