Cod sursa(job #250415)
Utilizator | Data | 30 ianuarie 2009 21:52:56 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <stdio.h>
long long i, t, p;
int main(void)
{
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
scanf("%lld", &p);
for (i=1;;i++)
{
p--;
if (i%5==0)
{
t=i;
while (t%5==0)
{
p--;
t/=5;
}
}
if (p<=0)
break;
}
printf("%lld", 5*i);
fcloseall();
return 0;
}