http://acm.hdu.edu.cn/showproblem.php?pid=2095
这题巧妙的运用了位运算的方法,同一个数位运算两次,化为0;多个数的话就留下了出现次数是奇数的那个数
View Code
1 #include<stdio.h> 2 int main() 3 { 4 int i,k,n,s; 5 while(scanf("%d",&n),n) 6 { 7 s=0; 8 for(i=0;i<n;i++) 9 { 10 scanf("%d",&k); 11 s^=k; 12 } 13 printf("%d\n",s); 14 } 15 }