pku1423 Big Number(Stirling公式)

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<map>
#include<queue>
#include <deque>
#include <list>
#include <ctime>
#include <stack>
#include <vector>
#include<set>
#define Maxn
#define MOD
typedef long long ll;
#define FOR(i,j,n) for(int i=j;i<=n;i++)
#define DFR(i,j,k) for(int i=j;i>=k;--i)
#define lowbit(a) a&-a
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
const double e=2.7182818284590452354;
using namespace std;
double str_ling(int n)
{   return 0.5*log10(2*pi*n)+n*log10(n/e);
}
int main()
{   int t,m;
    cin>>t;
    while(t--)
    {
        cin>>m;
        cout<<(int)str_ling(m)+1<<endl;
    }
    return 0;
}




你可能感兴趣的:(Stirling公式)