思路:
考虑xor的性质,两个相同的数异或起来是0,那么就可以把所有数异或起来,然后最后剩下的就是那个数
c
o
d
e
code
code
#include<iostream>
#include<cstdio>
using namespace std;
int n, ans;
int main()
{
scanf("%d", &n);
for(int i=1, x; i<=n; i++)
scanf("%d", &x), ans^=x;
printf("%d", ans);
return 0;
}