#include <iostream>
#include <cstdio>
#include <cmath>
#define PI 3.1415926535898
#define e 2.718281828459
using namespace std;
///斯特林
///n!=sqrt(2*PI*n)*pow(n/e,n)
int main()
{
int n;cin>>n;
while(n--){
long long m;
scanf("%lld",&m);
int len=ceil(log10((double)sqrt(2*PI*m))+m*(log10((double)m/e)));
cout<<len<<endl;
}
return 0;
}
斯特林公式(计算大数阶乘),码迷,mamicode.com
时间: 2024-10-13 00:07:05