Cod sursa(job #757720)
Utilizator | Data | 13 iunie 2012 02:35:01 | |
---|---|---|---|
Problema | Factorial | Scor | 85 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<stdio.h>
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
int p,n,k,x,i;
scanf("%d",&p);
k = 1;
n = 0;
x = 0;
i = 0;
do
{
i=0;
k=1;
x=0;
while(x-i+1<=p)
{
k *= 5;
x = 5*x+1;
i++;
}
n += k/5;
p -= x/5;
}while(p>0);
printf("%d",n);
return 0;
}