URAL 1792. Hamming Code (枚举)

1792. Hamming Code

Time limit: 1.0 second
Memory limit: 64 MB
Let us consider four disks intersecting as in the figure. Each of the three shapes formed by the intersectionof three disks will be called a petal.
Write zero or one on each of the disks. Then write on each petal the remainder in the division by two of the sumof integers on the disks that contain this petal. For example, if there were the integers 0, 1, 0, and 1 writtenon the disks, then the integers written on the petals will be 0, 1, and 0 (the disks and petals are given in theorder shown in the figure).
This scheme is called a Hamming code. It has an interesting property: if you enemy changes secretely anyof the seven integers, you can determine uniquely which integer has been changed. Solve this problem and you willknow how this can be done.
Problem illustration

Input

The only line contains seven integers separated with a space, each of them being zero or one. The first fourintegers are those written on the disks in the order shown in the figure. The following three integers are thosewritten on the petals in the order shown in the figure

Output

Output one line containing 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 that 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



解析:直接枚举哪个数字错了就可以,可是要注意错误数字最多仅仅可能是一个。!

PS:開始看到Hamming Code,还以为看到了计组的题。。。结果看了半天题目没看懂。

。。the remainder in the division by two of the sum of integers原来是数字和除以二之后的余数。

。。




posted @ 2016-02-22 21:32  phlsheji  阅读(235)  评论(0编辑  收藏  举报