题意:
求n的阶乘位数
思路:
模板题,有板就能过。。。
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <map>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#define go(i,a,b) for(int i=a;i<=b;i++)
#define og(i,a,b) for(int i=a;i>=b;i--)
#define mem(a) memset(a,0,sizeof(a))
#define cs cout<<"-----"<<endl;
using namespace std;
const int inf=0x3f3f3f3f;
const int maxn = 1e6 + 5;
const double pi = atan(1.)*4;
typedef long long ll;
int digit_stirling(int n)//得出n阶乘的位数
{
double PI=acos(double(-1));// PI的值=反余弦函数 -1.0为Pi, 1为0。
double e=exp(double(1));//e的值
return floor(log10(sqrt(2*PI*n))+n*log10(n/e))+1;
}
int main()
{
int t,n;
cin>>t;
while(t--)
{
cin>>n;
cout<<digit_stirling(n)<<endl;
}
return 0;
}