Cod sursa(job #383570)
Utilizator | Data | 16 ianuarie 2010 21:33:37 | |
---|---|---|---|
Problema | Factorial | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <stdio.h>
int main ()
{
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
int p, i=5, x=0, y;;
scanf("%d", &p);
if (p!=0) {
while (p!=0) {
y=i;
x=0;
while (y%5==0) {
x++;
y/=5;
}
p-=x;
if (p<=0) {
break;
}
i+=5;
}
printf("%d", i);
} else {
printf("1");
}
return 0;
}