Cod sursa(job #1087046)
Utilizator | Data | 18 ianuarie 2014 21:00:14 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <cstdio>
using namespace std;
int n, i, x, p, nr;
int main(){
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
scanf("%d ", &p);
if(p == 0)
printf("1\n");
else{
i = 5;
while(nr < p - 1){
i += 5;
int x = i;
while(x > 0 && x % 5 == 0)
++nr,
x /= 5;
}
printf("%d\n", i);
}
return 0;
}