#include<math.h>
double count_digit(long a)
{
double sum; long i;
if(a==0) return 1;
else
{
sum=0;
for(i=1;i<=a;i++)
sum+=log10(i);
return floor(sum)+1;
}
}
int main()
{
double sum; long n;
while(scanf("%ld",&n)==1)
{
sum = count_digit(n);
printf("%.0lf\n",sum);
}
return 0;
}
/*
Input: 10 20 50 55555
Output: 7 19 65 239469
*/
No comments:
Post a Comment