题解 | 被打乱的异或和
被打乱的异或和
https://www.nowcoder.com/practice/116db6858c424fb89b821125053bbc15
C++ 把握异或的规律
#include <iostream> #include <vector> using namespace std; int main() { int t, n; cin >> t; while (t--) { cin >> n; vector<int> a; while (n--) { int ai; cin >> ai; a.push_back(ai); } // 异或 xor ^ 相同为0 不同为1 // a1 xor a2 xor ... xor an-1 = x cout << a[0] << endl; } } // 64 位输出请用 printf("%lld")