/*
http://acm.hdu.edu.cn/showproblem.php?pid=2095
题意:只有一个数的个数为奇数,求这个数
异或:一个数的偶数次异或值为0:1^1=0, 2^2=0, 3^3^3^3 = 0
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
freopen("in", "r", stdin);
#endif
int n;
while(scanf("%d", &n), n){
int res = 0, a;
for(int i=0; i<n; i++){
scanf("%d", &a);
res ^= a;
}
printf("%d\n", res);
}
return 0;
}
异或 hdu 2095 find your present (2)
最新推荐文章于 2019-08-20 20:57:30 发布