URAL 1792. Hamming Code (enumeration)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.