摘要:靠公式过的。都打表会超时,有牛人只对奇数打表过的。
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
const int PI = 3.1415926;
int main()
{
long long num;
int len;
int count;
cin >> count;
while(count>0){
cin >> num;
if(num==1){
cout << num << endl;
}else{
len = ceil((num*log(num)-num+log(2*num*PI)/2)/log(10));
cout << len << endl;
}
count--;
}
return 0;
}