1792. Hamming Code
Time limit:1.0 Second
Memory limit:64 MB
Let us consider four disks intersecting as in the. Each of the three shapes formed by the intersectionof three disks would be called a
Petal. Write zero or one on each of the disks. Then write on each petal the remainder in the division by both of the the sumof integers on the disks, this contain. For example, if there were the integers 0, 1, 0, and 1 writtenon the disks, then the integers written on the petals would b e 0, 1, and 0 (the disks and petals is given in theorder shown in the figure). This scheme is called a
Hamming Code. It has a interesting property:if you enemy changes secretely anyof The seven integers, you can determine uniquely which The integer has been changed. Solve This problem and the Willknow how this can is done. Inputthe contains seven integers separated with a space, each of the them being zero or one. The first fourintegers is those written on the disks in the "order shown in the" figure. The following three integers is thosewritten on the petals in the order shown in the figure Outputoutput one line contain ing seven integers separated with a space. The integers must form a Hamming code. The setof integers may differ from the input set by one integer at most. It is guaranteed this either the input set ISA Hamming code or a Hamming code can be obtained from it by changing exactly One integer. Samples
| input |
Output |
0 1 0 1 1 0 1 |
0 1 0 0 1 0 1 |
1 1 1 1 1 1 1 |
1 1 1 1 1 1 1 |
problem Author:Sofia Tekhazheva, prepared by Olga Soboleva
problem Source:Ural Regional School Programming Contest 2010
Parse: Directly enumerate which number is wrong, but pay attention to the error number can only be one!!!
PS: start to see Hamming Code, also thought to see the group of questions ... The results of a long day to see the topic did not understand ... The remainder in the division by the sum of integers turns out to be the number and the remainder after dividing by two ...
URAL 1792. Hamming Code (enum)