Pro.ID10132 TitleHamming Codes Title链接http://10.20.2.8/oj/exercise/problem?problem_id=10132 AC35 Submit98 Ratio35.71% 时间&空间限制描述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 Since five bits were different, the Hamming distance is 5. 输入Multiple test case. For each case: N, B, D on a single line. 输出Description 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 Since five bits were different, the Hamming distance is 5. Input Multiple test case. For each case: N, B, D on a single line. Output For each case, output N codewords, sorted, in decimal, ten per line. In the case of multiple solutions, your program should output the solution which, if interpreted as a base 2B integer, would have the least value. Output a blank line after each case. Sample Input 16 7 3 Sample Output 0 7 25 30 42 45 51 52 75 76 Source 样例输入16 7 3 样例输出0 7 25 30 42 45 51 52 75 76 作者 |