(from https://math.stackexchange.com/questions/319551/nim-addition-binary-addition-without-carrying)

http://codeforces.com/contest/809/problem/C
(假设从0开始编号,要证明坐标(i,j)的数字为i XOR j)


So, to interpret your question, you have two different procedures for filling out a table of numbers which has a definite top and left edge, but continues indefinitely down and to the right. First is

Don’t fill in any cell before all the positions directly above and directly to the left of it are filled.
Write in each cell the smallest nonnegative integer that doesn’t appear in any cell directly above it or directly to the left of it
The second is

Write in the cell with (zero-based) coordinates (i,j)(i,j) the number i⊕ji\oplus j, where ⊕\oplus is the bitwise XOR operation (that is, as you say, binary addition with no carries).
And you want to prove that these two methods result in the same value in each cell of the table.

We can prove that by long induction on ii and jj. For the induction step we imagine that the cells above and to the left of (i,j)(i,j) have already been filled with the ⊕\oplus of their coordinates, and we want to prove that step (2) of the first procedure results in exactly i⊕ji\oplus j.

One half of this is easy: since ⊕\oplus is a group operation, i⊕ji\oplus j cannot equal i⊕bi\oplus b or a⊕ja\oplus j for any b≠jb\ne j or a≠ia\ne i – in particular not for any smaller aa or bb.

We then need to prove that i⊕ji\oplus j is the least number that hasn’t yet been used in the same row or column. In other words, every c<i⊕jc must already have been used somewhere.

Consider the most significant bit position where cc differs from i⊕ji\oplus j. Because cc is less than i⊕ji\oplus j, there must be a 0 in this position of cc and a 1 in the position of i⊕ji\oplus j. The latter 1 must come from either ii or jj. Assume it comes from ii (the other case is exactly similar). Then flipping that bit of ii produces a number a0a_0 such that a0⊕ja_0\oplus j agrees with cc up to and including the bit position of first difference. With appropriate adjustments to the less significant bits we can get an aa such that a⊕j=ca\oplus j=c. And this aa must be less than ii, because aa and ii first differ on a bit position that has 1 in ii and 0 in aa.

This completes the induction step, and thus the proof.

大致意思是先构造一个(i,j)(i,j)数字为i XOR j的矩阵,再证明小于i XOR j的数在同一行(?<i,j)(?、同一列(i,?<j)(i,? 上都出现过.
证明类似nim和:设i XOR j=d,对任一0 <=x < d,一定存在一个二进制位,x在这位为0,d在这位为1,那么可以通过减小i或j使新的i XOR j=x.

CF 809C about proof of previous solution相关推荐

  1. Toward a More Complete, Flexible, and Safer Speed Planning for Autonomous Driving via Convex Optimiz

    Toward a More Complete, Flexible, and Safer Speed Planning for Autonomous Driving via Convex Optimiz ...

  2. 如何在JavaScript中切片和拼接数组

    .slice() and .splice() are similar methods in JavaScript. They look similar, they sound similar, and ...

  3. crontab 最小间隔_今天我间隔了:如何找到不在数组中的最小数字

    crontab 最小间隔 by Marin Abernethy 通过Marin Abernethy 今天我间隔了:如何找到不在数组中的最小数字 (Today I Spaced: how to find ...

  4. Populating Next Right Pointers in Each Node II

    Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tre ...

  5. 如何使用Swift获取App版本和内部版本号?

    本文翻译自:How do I get the App version and build number using Swift? I have an IOS app with an Azure bac ...

  6. 从Java 8中的java.util.stream.Stream检索列表

    本文翻译自:Retrieving a List from a java.util.stream.Stream in Java 8 I was playing around with Java 8 la ...

  7. Leetcode: Populating Next Right Pointers in Each Node II

    Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree ...

  8. leetcode - Populating Next Right Pointers in Each Node II

    Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tre ...

  9. ML之LiRLasso:基于datasets糖尿病数据集利用LiR和Lasso算法进行(9→1)回归预测(三维图散点图可视化)

    ML之LiR&Lasso:基于datasets糖尿病数据集利用LiR和Lasso算法进行(9→1)回归预测(三维图散点图可视化) 目录 基于datasets糖尿病数据集利用LiR和Lasso算 ...

最新文章

  1. C语言经典小游戏---猜数字游戏 (包含C语言中如何实现随机数的生成)
  2. 实战经验:MySQL 构建高并发网站性能优化
  3. mysql二维数组vb_VBA链接MYSQL的帮助类
  4. 6月21 百度文本编辑器
  5. .net core百万设备连接服务和硬件需求测试
  6. 【JavaScript】百度地图API快速上手
  7. Redis哈希表总结
  8. JavaScript--数据结构算法之链表
  9. Android入门笔记10
  10. 台式计算机常用总线,计算机中常见的总线有哪些
  11. 简约竞聘个人简历自我介绍PPT模板
  12. 地理加权回归学习记录
  13. base64编码以及b' '前缀的去除
  14. Office 365系列之十三:Office 365管理员角色
  15. springboot配置druid内置监控页面
  16. 浅析人工智能体系建设
  17. 什么是函数?什么是无参函数?什么是返回值?函数的分类?
  18. 深度学习: 数据扩充 (Data Augmentation)
  19. knockout js之select
  20. 关于数据库中FK的简单理解以及应用

热门文章

  1. 面向新手的西门子博途软件常用功能介绍
  2. windows操作系统知识点
  3. 数据结构(Java实现)-详谈树与二叉树结构
  4. 道客巴巴(doc88)下载器的使用方法
  5. 什么是AR增强现实技术
  6. Android 一个像素几个字节,android 像素单位的一系列疑问困扰
  7. 零售业进入立异时期:O2O榜首战
  8. Scarborough Fair
  9. 计算机教室报废报损申请表,资产报废报损申请表.doc
  10. C语言直接清空数组、字符串