# hamming

【题目描述】

Hamming Codes
Rob Kolstad Given N, B, and D: Find a set of N codewords (1 <= N <= 64), each of length B bits (1 <= B <= 8), such that each of the codewords

is at least Hamming distance of D (1 <= D <= 7) away from each of the other codewords. The Hamming distance between a pair of codewords is the number of binary bits that differ in their binary notation. Consider the two codewords 0x554 and 0x234 and their differences (0x554 means the hexadecimal number with hex digits 5, 5, and 4): 0x554 = 0101 0101 0100 0x234 = 0010 0011 0100 Bit differences: xxx xx Since five bits were different, the Hamming distance is 5. 【我的思路】 穷举一遍，直到达到个数。比较坑爹的是它要和之前输出的数都比较一遍，才能输出当前的 数，而且是汉明码大于等于 d 就可以。 【code】 { ID:yxy07015 PROG:hamming LANG:PASCAL } var n,m,d,s,num,i,j:integer; a:array[1..8] of integer; c:array[1..64,1..8] of integer; function check:boolean; var k:integer; begin for i:=1 to num do begin k:=0; for j:=1 to m do if a[j]<>c[i,j] then inc(k); if k<d then exit(false); end; exit(true); end; begin assign(input,'hamming.in'); reset(input); assign(output,'hamming.out'); rewrite(output);

readln(n,m,d); num:=1; s:=1; a[1]:=1; write('0 '); while num<n do begin if check then begin inc(num); c[num]:=a; if (num mod 10=0) or (num=n) then writeln(s) else write(s,' '); end; inc(a[1]); inc(s); for i:=1 to m do if a[i]>1 then begin dec(a[i],2); inc(a[i+1]); end; end; close(input); close(output); end.

Executing... Test 1: TEST OK [0.003 secs, 276 KB] Test 2: TEST OK [0.000 secs, 276 KB] Test 3: TEST OK [0.000 secs, 276 KB] Test 4: TEST OK [0.000 secs, 276 KB] Test 5: TEST OK [0.000 secs, 276 KB] Test 6: TEST OK [0.000 secs, 276 KB] Test 7: TEST OK [0.000 secs, 276 KB] Test 8: TEST OK [0.000 secs, 276 KB] Test 9: TEST OK [0.003 secs, 276 KB] Test 10: TEST OK [0.000 secs, 276 KB] Test 11: TEST OK [0.000 secs, 276 KB] All tests OK.

Hamming(7,4)编译码器实验报告8.8
8.8 Hamming(7,4)编译码器 1.1 实验目的 ·加深理解 Hamming(7,4)码的编码方法和抗干扰性能; ·通过编程实现 Hamming(7,4)码的编码算法,进一步掌握按位二...
hamming神经网络电路

MATLAB各种“窗函数”定义及调用
4.海明窗(Hamming Window) 调用格式:w=hamming(n),根据长度 n 产生一个海明 窗 w。 5.布拉克曼窗(Blackman Window)调用格式:w=blackman(n),根据长度 n ...

(msg,N,K,'hamming') %(7,4)汉明编码,输出为3行7列的已编码矩阵 nois=randerr(row_num,N) code_noise=rem(code(:,:)+nois(:,:),2) %编码后进入...