Pagini recente » Cod sursa (job #1239237) | Cod sursa (job #2290058) | Cod sursa (job #425083) | Cod sursa (job #1875296) | Cod sursa (job #3170190)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int solve(int p) {
int n = 1;
int c0 = 0;
while (c0 != p && n <= 1000000) {
int f = n;
while (f % 5 == 0) {
c0++;
f /= 5;
}
n++;
}
if (c0 == p) {
return n - 1;
}
else {
return -1;
}
}
int main() {
int p;
fin >> p;
int sol = solve(p);
fout << sol << '\n';
return 0;
}