这题直接暴力

假设x为a[i],然后遍历求其它所有值的异或,判断是否相等,如果相等那么就直接输出x



import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner=new Scanner(System.in);
		int t=scanner.nextInt();
		while(t-->0) {
			int n=scanner.nextInt();
			int a[]=new int[n];
			for (int i = 0; i < a.length; i++) {
				a[i]=scanner.nextInt();
			}
			for (int i = 0; i < a.length; i++) {
				int x=a[i];
//				0与其它数的异或都是其它数本身
				int temp=0;
				
				for (int j = 0; j<a.length; j++) {
					if(j==i)continue;
					temp=temp^a[j];
					
				}
				if(temp==x) {
					System.out.println(x);
					break;
				}
			}
		}

	}

}