返回题解分享
讨论 / 题解分享/ 帖子详情

01 串的熵(结果填空) - 题解

#include<iostream>
#include<cstring>
#include<algorithm>
#include<math.h>
using namespace std;
#define  N 23333333
int main()
{
	for(int x=1;x<N/2;x++)
	{
	 double p0=x*1.0/N,p1=(N-x)*1.0/N;
	 if(abs(-x*p0*log2(p0)-(N-x)*p1*log2(p1)-11625907.5798)<0.0001)
	 {
	 	cout<<x<<endl;
	 	return 0;
	 }
	}
}
0 回复 0 转发 0 喜欢 6 阅读
回复 (0)
默认 最新
暂无回复,快来抢沙发!