Cod sursa(job #882374)
| Utilizator | Data | 19 februarie 2013 02:03:41 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <stdio.h>
int five_factors(int n) {
long result = 0;
while (n > 1) {
result++;
n /= 5;
}
return result;
}
int main() {
freopen("flip.in", "rt", stdin);
freopen("flip.out", "wt", stdout);
long p, n = 0, factors[11] = {0}, actual = 0, top = 0;
while (actual < p) {
n += 5;
factors[top]++;
if(factors[top] == 0)
top++;
actual += top;
}
printf("%d", actual == p ? n : -1);
return 0;
}