题解
2026-08-31 14:15:26
发布于:浙江
17阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
int r = 0;
int a;
for (int i = 0; i < n; i++) {
cin >> a;
r ^= a; //0^a=a,a^a=0
//r^2=2
//2^2=0
//0^1=1
//1^3=01^11=10=2
//2^3=10^11=01=1
//1^3=01^11=10=2
//2^2=0
//0^3=3
//3^1=11^01=10=2
//r=2
}
cout << r << endl;
return 0;
}
这里空空如也








有帮助,赞一个