Cod sursa(job #217582)
Utilizator | Data | 28 octombrie 2008 23:02:55 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<stdio.h>
int i,p,count,n,c,ok;
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%d",&p);
n--;
for(i=5;count<=p;i=i+5)
{
n++;
c = i;
ok = 0;
while(c)
{
if(c%5==0)
ok++;
c /= 5;
}
if(ok>0)
count += ok;
else
count++;
}
if(p==0)
printf("1");
else
printf("%d",n*5);
return 0;
}