随笔分类 -  异或

摘要:给定 $n$ 个两两不同的正整数 $a_1, a_2, \dots, a_n$,$a_i Let the length of a number be the number of digits needed to write it out in binary, excluding any leadin 阅读全文
posted @ 2019-09-16 02:40 Pat 阅读(398) 评论(0) 推荐(0)
摘要:"题目链接" 分析 异或运算满足「三角不等式」。 $\forall a, b, c \in \mathbb{Z}\_{\ge 0}$,有 $a \xor b \le (a \xor c) + (c \xor b)$ 。 证明:容易证明:$\forall a, b \in \mathbb{Z}_{\g 阅读全文
posted @ 2019-08-25 17:29 Pat 阅读(148) 评论(0) 推荐(0)
摘要:X or What? 符号约定: $\xor$ 表示异或。 popcount($x$) 表示非负整数 $x$ 的二进制表示里数字 1 出现的次数。例如,$13 = 1101_2$,则 popcount(13) = 4。 注意到,popcount($a \xor b$) = popcount($a$) 阅读全文
posted @ 2019-07-28 17:38 Pat 阅读(382) 评论(0) 推荐(0)