Cod sursa(job #501586)
Utilizator | Data | 15 noiembrie 2010 20:11:09 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include<stdio.h>
#include<math.h>
int main()
{
freopen("fact.txt","r",stdin);
freopen("fact.out","w",stdout);
long P,N,i,x=1;
scanf("%ld",&P);
for (N=1;;N++)
{
for (i=1;i<=N;i++)
x=x*i;
for(i=1;i<=P-1;i++)
x=x/10;
if (x>=1)
{
printf("%ld",N);
break;
}
}
return 0;
}