Cod sursa(job #23939)
Utilizator | Data | 1 martie 2007 17:37:44 | |
---|---|---|---|
Problema | Factorial | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <stdio.h>
int main() {
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
int n;
scanf("%d",&n);
if (n == 0) {
printf("1\n");
return 0;
}
int exp = 0;
int cur;
for (cur = 5; exp < n; cur += 5) {
int tmp = cur;
while (tmp % 5 == 0) {
++exp;
tmp /= 5;
}
}
printf("%d\n",cur-5);
return 0;
}