**链接:****传送门 **

题意:给出n个数,这n个数中只有一种数出现奇数次,其他全部出现偶数次,让你找到奇数次这个数

思路:简单异或运算题


/*************************************************************************
    > File Name: hdu2095.cpp
    > Author:    WArobot 
    > Blog:      http://www.cnblogs.com/WArobot/ 
    > Created Time: 2017年05月10日 星期三 15时47分03秒
 ************************************************************************/

#include<bits/stdc++.h>
using namespace std;

int n,x;
int main(){
	while(~scanf("%d",&n) && n){
		scanf("%d",&x);
		int tmp = x;
		for(int i=1;i<n;i++){
			scanf("%d",&x);
			tmp ^= x;
		}
		printf("%d\n",tmp);
	}
	return 0;
}

相关文章:

  • 2022-12-23
  • 2021-08-16
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-05
  • 2022-01-26
猜你喜欢
  • 2021-07-02
  • 2022-01-09
  • 2021-06-29
  • 2021-10-15
  • 2021-11-01
  • 2021-07-02
相关资源
相似解决方案