You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
772 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int main() {
/**
数学表示:
a ^ a ^ b = b;
a ^ b ^ a = b;
b ^ a ^ a = b;
原理:
可用穷举法证明:
异或运算1 ^ 1 = 01 ^ 0 = 1; 0 ^ 1 = 1; 0 ^ 0 = 0;
穷举: 1 ^ 1 ^ 1 = 1
1 ^ 1 ^ 0 = 0
1 ^ 0 ^ 1 = 0
0 ^ 1 ^ 1 = 0
1 ^ 0 ^ 0 = 1
0 ^ 1 ^ 0 = 1
0 ^ 0 ^ 1 = 1
0 ^ 0 ^ 0 = 0
可知任意1或0出现两次即可抵消。 从而推广至多个位bit
一个数异或同一个数两次,结果还是那个数。 且异或的顺序可变。
证明https://www.zhihu.com/question/62003033
*/
return 0;
}