Initial commit
This commit is contained in:
13
14lanqiao/test2.cpp
Normal file
13
14lanqiao/test2.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
double n = 23333333;
|
||||
double res = 11625907.5798;
|
||||
for(int a = 0; a <= n; a++){ // a为0出现的次数
|
||||
int b = n - a; // b为1出现的次数
|
||||
if(a>=b) continue;
|
||||
double ans = (-1)*a*(a/n)*log2(a/n) + (-1)*b*(b/n)*log2(b/n);
|
||||
if(fabs(ans - res) < 1e-4) cout << a << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user