码迷,mamicode.com
首页 > 其他好文 > 详细

HDU-1018 BigNumber(斯特林近似)

时间:2018-11-23 20:47:36      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:ber   gnu   mes   big   err   php   efi   ref   font   

题目链接

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

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

  

HDU-1018 BigNumber(斯特林近似)

标签:ber   gnu   mes   big   err   php   efi   ref   font   

原文地址:https://www.cnblogs.com/DuskOB/p/10009215.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!