Pagini recente » Cod sursa (job #375515) | Cod sursa (job #330078) | Cod sursa (job #2217144) | Cod sursa (job #2166496) | Cod sursa (job #630205)
Cod sursa(job #630205)
#include <cstdio>
using namespace std;
inline int zerosAtEndOfFact (long int x) {
int s = 0, pow5 = 5;
while (x > pow5) {
s += x / pow5;
pow5 *= 5;
}
return s;
}
int main () {
int P, i = 1;
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
scanf("%d", &P);
while (i <= 100000000) {
if (zerosAtEndOfFact(i) == P) {
printf("%d", i);
return 0;
}
i++;
}
printf("%d", -1);
return 0;
}