- 博客(3)
- 收藏
- 关注
原创 信息熵的Python实现
import math # 概率队列 pi = [0.125, 0.125, 0.125, 0.125, 0.125, 0.125, 0.125, 0.125] log = [] # 对pi中的每一个数求以2为底的对数 for i in pi: log.append(math.log(i, 2)) # pi与logN对应相乘 product = [x*y for x, y in zip(pi, log)] sum = 0.0 for number in product: sum +.
2022-03-19 22:22:59
1148
原创 CSP 202104-1 灰度直方图
#include <iostream> #include <cstdio> using namespace std; int main(){ int n,m,L; cin >> n >> m >> L; int A[n][m]; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin >> A[i][j]; } } int count[L] = ...
2022-03-02 11:41:10
44
原创 数组初始化方式
int arr[5] = { 0 }; //仅当全设为0时可以这样写 int arr[5] = { 1}; //值为 1 0 0 0 0
2022-03-01 19:06:08
64
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人