HDU-1018 BigNumber(斯特林近似)

题目链接

斯特林近似求数位长度经典题,更新板子顺手切了

#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;
}

  

posted @ 2018-11-23 18:37  WstOne  阅读(115)  评论(0编辑  收藏  举报