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 = 0;1 ^ 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;
}