ZCMU-1129

image
image
数学公式题罢了
学长


1.斯特灵公式:image
2.对数公式(因为以10为底,得到的是10^x,所以最后向下取整加上1);

#include<cstdio>
#include<cmath>
using namespace std;
const double PI=acos(-1);
const double e=exp(double(1));
int str(int n){
    return floor(log10(sqrt(2*PI*n))+n*log10(n/e))+1;
}
int main(){
    int n;
    while(~scanf("%d",&n)){
        if(n<=3)printf("1\n");
        else
        printf("%d\n",str(n));
    }
    return 0;
}
posted @ 2024-04-29 18:31  海&贼  阅读(1)  评论(0编辑  收藏  举报