斯特林近似求数位长度经典题,更新板子顺手切了
#include <cstdio> #include <cmath> #include <cstring> #include <iostream> #include <algorithm> #define DBG(x) cerr << #x << " = " << x << endl; const double PI = acos(-1.0); using namespace std; int t,n; int main(){ scanf("%d",&t); while(t--){ scanf("%d",&n); printf("%d\n",(int)((0.5*log(2*PI*n)+n*log(n)-n)/(log(10)))+1); } return 0; }
原文地址:https://www.cnblogs.com/DuskOB/p/10009215.html
时间: 2024-11-19 19:14:34