跳到正文

个人记录

常用的性质们

SkyWave约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年2月11日
篇幅
约 1 分钟

版本

  1. v1当前

异或

设 x⊕yx \oplus y 为 xx 与 yy 按位异或的结果,x⊕y⊕zx \oplus y \oplus z 为 xx 与 yy 的按位异或的结果,与 zz 进行异或的结果,即 (x⊕y)⊕z(x \oplus y) \oplus z。

前缀异或和

设:

S(n)=1⊕2⊕3⊕⋯⊕nS(n) = 1 \oplus 2 \oplus 3 \oplus \cdots \oplus n

则有:

S(n)={nif n mod 4=01if n mod 4=1n+1if n mod 4=20if n mod 4=3S(n) = \begin{cases} n & \text{if } n \bmod 4 = 0 \\ 1 & \text{if } n \bmod 4 = 1 \\ n+1 & \text{if } n \bmod 4 = 2 \\ 0 & \text{if } n \bmod 4 = 3 \\ \end{cases}

异或与矩阵

设 aa 为一个 nn 行 mm 列矩阵,矩阵内每个元素为非负整数。设 aija_{i_j} 为 aa 第 ii 行与第 jj 列的交点的元素的值。

对于 i∈[n]i \in [n],设 rir_i 为 ⨁j=1maij\bigoplus_{j=1}^{m} a_{i_j},对于 i∈[m]i \in [m],设 cic_i 为 ⨁j=1maji\bigoplus_{j=1}^{m} a_{j_i},则有:

(⨁i=1nri)=(⨁i=1mci)\left( \bigoplus_{i=1}^{n} r_i \right) = \left( \bigoplus_{i=1}^{m} c_i \right)
原文