Cod sursa(job #711254)
| Utilizator | Data | 11 martie 2012 19:41:47 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.65 kb |
#include <stdio.h>
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
long long int p,n,ok,ok1,i,s;
scanf("%lld",&p);
ok=0;
n=1;
while(ok==0)
{
i=1;
s=1;
while(i<=n)
{
s=s*i;
i++;
}
ok1=1;
for(i=1;i<=p && s;i++)
{
if(s%10!=0)
{
ok1=0;
break;
}
s=s/10;
}
if(ok1==1)
{
ok=1;
printf("%lld",n);
}
n++;
}
return 0;
}
