公式记住就好了。百度百科有解释
e可以用exp(1)表示,省着记了
#include <iostream>
#include <cmath>
#include <stdio.h>
typedef long long ll;
double PI=acos(-1);
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
ll res = 0.5 * log10(2.0 * PI * n) + n * log10(n * 1.0 /exp(1)) + 1;
cout << res << endl;
}
return 0;
}