Pagini recente » Monitorul de evaluare | Cod sursa (job #101922) | Cod sursa (job #1807862) | Cod sursa (job #1469394) | Cod sursa (job #3170204)
#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;
if (p == 0) return 1;
while (c0 != p) {
int f = n;
while (f % 5 == 0 && c0 != p) {
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';
cout << clock();
fin.close();
fout.close();
return 0;
}