Problem Description
元宵节到了,Snow 也准备一掷千金买汤圆来庆祝元宵节。Snow 非常慷慨,他将分享给你一定数量的汤圆,那么是多少个汤圆呢?答案是 n!(n 的阶乘)…… 嘻嘻别傻了,Snow 要分享给你的是 n! 的位数个汤圆,但前提是你得求出 n! 有多少位哦。
Input
输入数据有多组(数据组数不超过 500),到 EOF 结束。
每组数据输入 n (1 <= n <= 500)。
Output
对于每组数据,输出一行,表示 n! 的位数。
Example Input
1
20
Example Output
1
19
#include <stdio.h>
#include <math.h>
int main()
{
int n;
while(~scanf("%d", &n))
{
int i;
double ans=0;
for(i=1; i<=n; i++)
ans+=log10((double)i);
printf("%d\n", (int)ans+1);
}
}