zoukankan      html  css  js  c++  java
  • 遥远的相似性——异或运算

    前两天做校内题的时候突然发现模意义下的组合数和一个奇妙序列完全相同。


    (2) 意义下的组合数表:

    1
    11
    101
    1111
    10001
    110011
    1010101
    11111111
    100000001
    1100000011
    10100000101
    111100001111
    1000100010001
    11001100110011
    101010101010101
    1111111111111111
    10000000000000001
    110000000000000011
    1010000000000000101
    11110000000000001111
    100010000000000010001
    1100110000000000110011
    10101010000000001010101
    111111110000000011111111
    1000000010000000100000001
    11000000110000001100000011
    101000001010000010100000101
    1111000011110000111100001111
    10001000100010001000100010001
    110011001100110011001100110011
    1010101010101010101010101010101
    11111111111111111111111111111111
    100000000000000000000000000000001
    1100000000000000000000000000000011
    10100000000000000000000000000000101
    111100000000000000000000000000001111
    1000100000000000000000000000000010001
    11001100000000000000000000000000110011
    101010100000000000000000000000001010101
    1111111100000000000000000000000011111111
    10000000100000000000000000000000100000001
    110000001100000000000000000000001100000011
    1010000010100000000000000000000010100000101
    11110000111100000000000000000000111100001111
    100010001000100000000000000000001000100010001
    1100110011001100000000000000000011001100110011
    10101010101010100000000000000000101010101010101
    111111111111111100000000000000001111111111111111
    1000000000000000100000000000000010000000000000001
    11000000000000001100000000000000110000000000000011
    101000000000000010100000000000001010000000000000101
    1111000000000000111100000000000011110000000000001111
    10001000000000001000100000000000100010000000000010001
    110011000000000011001100000000001100110000000000110011
    1010101000000000101010100000000010101010000000001010101
    11111111000000001111111100000000111111110000000011111111
    100000001000000010000000100000001000000010000000100000001
    1100000011000000110000001100000011000000110000001100000011
    10100000101000001010000010100000101000001010000010100000101
    111100001111000011110000111100001111000011110000111100001111
    1000100010001000100010001000100010001000100010001000100010001
    11001100110011001100110011001100110011001100110011001100110011
    101010101010101010101010101010101010101010101010101010101010101
    1111111111111111111111111111111111111111111111111111111111111111


    一个全零的序列,只有第一位为 1,每一次保持第一位不变,其他位全都异或上前一位,会得到如下的序列:

    1
    11
    101
    1111
    10001
    110011
    1010101
    11111111
    100000001
    1100000011
    10100000101
    111100001111
    1000100010001
    11001100110011
    101010101010101
    1111111111111111
    10000000000000001
    110000000000000011
    1010000000000000101
    11110000000000001111
    100010000000000010001
    1100110000000000110011
    10101010000000001010101
    111111110000000011111111
    1000000010000000100000001
    11000000110000001100000011
    101000001010000010100000101
    1111000011110000111100001111
    10001000100010001000100010001
    110011001100110011001100110011
    1010101010101010101010101010101
    11111111111111111111111111111111
    100000000000000000000000000000001
    1100000000000000000000000000000011
    10100000000000000000000000000000101
    111100000000000000000000000000001111
    1000100000000000000000000000000010001
    11001100000000000000000000000000110011
    101010100000000000000000000000001010101
    1111111100000000000000000000000011111111
    10000000100000000000000000000000100000001
    110000001100000000000000000000001100000011
    1010000010100000000000000000000010100000101
    11110000111100000000000000000000111100001111
    100010001000100000000000000000001000100010001
    1100110011001100000000000000000011001100110011
    10101010101010100000000000000000101010101010101
    111111111111111100000000000000001111111111111111
    1000000000000000100000000000000010000000000000001
    11000000000000001100000000000000110000000000000011
    101000000000000010100000000000001010000000000000101
    1111000000000000111100000000000011110000000000001111
    10001000000000001000100000000000100010000000000010001
    110011000000000011001100000000001100110000000000110011
    1010101000000000101010100000000010101010000000001010101
    11111111000000001111111100000000111111110000000011111111
    100000001000000010000000100000001000000010000000100000001
    1100000011000000110000001100000011000000110000001100000011
    10100000101000001010000010100000101000001010000010100000101
    111100001111000011110000111100001111000011110000111100001111
    1000100010001000100010001000100010001000100010001000100010001
    11001100110011001100110011001100110011001100110011001100110011
    101010101010101010101010101010101010101010101010101010101010101
    1111111111111111111111111111111111111111111111111111111111111111

    完 全 一 致


    事实上,二者的原理十分简单。考虑到组合数递推式:

    [inom nk=inom {n-1}{k-1}+inom {n-1}{k} ]

    在模 (2) 意义下,加法就直接成为了异或,这就使得两个序列惊人的相同。

  • 相关阅读:
    WPF可视对象变换(RenderTransform)-----RotateTransform、TranslateTransform、ScaleTransform
    WPF 基本图形
    C#创建DataTable
    WPFの触发器详解
    WPF绑定のRelativeSource
    287. Find the Duplicate Number
    238. Product of Array Except Self
    127. Word Ladder
    674. Longest Continuous Increasing Subsequence
    621. Task Scheduler
  • 原文地址:https://www.cnblogs.com/whx1003/p/14040568.html
Copyright © 2011-2022 走看看