1、第一题
自动化所的老师讲的自然语言的课的课后作业,要求是任意摘录一段文字,统计字符出现的相对频率,假设这些相对频率就是这些字符的概率,计算其分布的熵。
H(X) = -Σp(x) * log2(p(x)),
(x∈X)
#include<iostream>
#include<fstream>
#include<string>
#include<map>
#include<math.h>
#include<locale>
using namespace std;
map<char,int>m;
map<char,int>::