本文共 490 字,大约阅读时间需要 1 分钟。
原文转载:http://blog.csdn.net/triple_wdf/article/details/50993413
题意:给n个数字的序列,求所有子序列的异或,然后把所有子序列的结果再异或。
想法:如果n!=1显然每个数出现偶数次,那么一个数自己异或自己显然为0,如果n==1,直接输出那个数就好了啊。
#includeint main() { int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); __int64 res=0; for(int i=1;i<=n;i++) { scanf("%I64d",&res); } if(n==1) printf("%I64d\n",res); else printf("0\n"); } return 0; }