Cod sursa(job #882373)
| Utilizator | Data | 19 februarie 2013 02:02:35 | |
|---|---|---|---|
| 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;
}
if (actual > p)
return -1;
else
return n;
}