标签:int 题目 pac title 链接 ble html com 中文
题目链接: https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1130
题意: 中文题诶~
思路:
直接斯特林公式就好了~
N!=sqrt(2*pi*N)*(N/e)^N;(pi=3.1415926=acos(-1.0),e=2.718)
lgN!=(lg(2*pi)+lgN)/2+N*(lgN-lge);
本题求十进制长度, 将 lg 换成 log10 就好了啦~
代码:
1 #include <bits/stdc++.h>
2 using namespace std;
3
4 const double pi= M_PI;
5 const double e=M_E;
6
7 int main(void){
8 int t;
9 scanf("%d", &t);
10 while(t--){
11 int x;
12 scanf("%d", &x);
13 if(x==1){
14 printf("1\n");
15 continue;
16 }
17 long long gg=(log10(2*pi)+log10(x))/2+x*(log10(x)-log10(e));
18 printf("%lld\n", gg+1);
19 }
20 return 0;
21 }
标签:int 题目 pac title 链接 ble html com 中文
原文地址:http://www.cnblogs.com/geloutingyu/p/6216109.html