zoukankan      html  css  js  c++  java
  • 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原来是数字和除以二之后的余数。

    。。




  • 相关阅读:
    事务和锁
    Spring AOP @before@after@around@afterreturning@afterthrowing执行顺序
    免安装绿色版本tomcat的问题
    Myeclipse代码提示及如何设置自动提示
    the field DBMS must be defined
    zip4j 2.0压缩 加密压缩
    HttpClient4.x 上传文件
    转发小程序
    【Maven】使用Maven构建多模块项目
    微信小程序官方示例 官方weui-wxss下载于安装 详解
  • 原文地址:https://www.cnblogs.com/bhlsheji/p/5208200.html
Copyright © 2011-2022 走看看