#P1461. [USACO2.1] 海明码 Hamming Codes
[USACO2.1] 海明码 Hamming Codes
Description
Given , find binary codewords consisting of 0 and 1, each with bits, such that the Hamming distance between every pair of codewords is at least .
The Hamming distance is the number of differing bit positions between two binary codewords. For example, the Hamming distance between 0101 0101 0100 and 0010 0011 0100 is :
0101 0101 0100
0010 0011 0100
^^^ ^^
Input Format
One line containing three integers .
Output Format
Output the lexicographically smallest solution (the codewords must also be printed in ascending order). Print a newline after every codewords.
You should first treat each codeword as a binary number, then convert it to a decimal number for output.
16 7 3
0 7 25 30 42 45 51 52 75 76
82 85 97 102 120 127
Hint
Constraints: For of the testdata, , , .
Please note: the problem only requires the Hamming distance to be at least , so it may also be greater than .
USACO 2.1
Translation from NOCOW
Translated by ChatGPT 5
京公网安备 11011102002149号