题目链接:这里写链接内容
输入N求N的阶乘的10进制表示的长度。例如6! = 720,长度为3。
Input
第1行:一个数T,表示后面用作输入测试的数的数量。(1 <= T <= 1000)
第2 - T + 1行:每行1个数N。(1 <= N <= 10^9)
Output
共T行,输出对应的阶乘的长度。
Input示例
3
4
5
6
Output示例
2
3
3
用斯特林公式,不知道的可以先看这篇传送门
#include<iostream>
#include<cstdio>
#include<cmath>
const double pi=acos(-1);
const double e=2.718281828459;
typedef long long ll;
using namespace std;
int main(){
int t;
scanf("%d",&t);
for(int i=0;i<t;i++){
ll n;
scanf("%lld",&n);
ll ans=0;
ans=0.5*log10(2.0*pi*n)+1.0*n*log10(1.0*n/exp(1.0))+1;
printf("%lld\n",ans);
}
}