公式/定理

 1 // 2018年全国多校算法寒假训练营练习比赛(第三场)
 2 // 不凡的夫夫
 3 #include <iostream>
 4 #include <cstdio>
 5 #include <cstring>
 6 #include <string>
 7 #include <utility>
 8 #include <algorithm>
 9 #include <vector>
10 #include <queue>
11 #include <stack>
12 #include <cmath>
13 using namespace std;
14 #define max(x,y) x>=y?x:y
15 #define lowbit(x) x&(-x)
16 #define M 1e-8
17 #define pi acos(-1.0)
18 #define e 2.718281828
19 typedef unsigned  long long ull;
20 typedef long long ll;
21  
22 int n,t;
23 int main()
24 {
25     scanf("%d",&t);
26     while(t--)
27     {
28      
29         scanf("%d",&n);
30         if(n==0)//特判
31         {
32             printf("1\n");
33             continue;
34         }
35     long double ans= (log10(2*pi*n)*0.5+n*log10(n/e))/log10(8);  //换底公式
36         printf("%lld\n",(ll)ans+1);      
37     }
38     return 0;
39 }
40 //  Stirling公式)
41 // https://www.cnblogs.com/zhangshu/archive/2011/08/12/2135855.html

 1 // 素数定理 2 // https://blog.csdn.net/kalilili/article/details/44835285 

猜你喜欢

转载自www.cnblogs.com/tingtin/p/9340610.html
今日推荐