我们考虑集合中的每个数x对答案的贡献。 设集合有n个数,则包含x的子集个数有2^(n-1)个。 那么当n > 1时,x出现了偶数次,所以其对答案的贡献就是0;当 n = 1时,其对答案的贡献是 x。

AC代码:

 #pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<stdlib.h>
#include <stack>
using namespace std;
#define PI acos(-1.0)
#define max(a,b) (a) > (b) ? (a) : (b)
#define min(a,b) (a) < (b) ? (a) : (b)
#define ll long long
#define eps 1e-10
#define MOD 1000000007
#define N 1006
#define inf 1e12
int n;
int a[N];
int main()
{
int t;
scanf("%d",&t);
while(t--){ scanf("%d",&n);
for(int i=;i<n;i++){
scanf("%d",&a[i]);
}
if(n>){
printf("0\n");
continue;
}
if(n==){
int sum = a[];
for(int i=;i<n;i++){
sum=sum^a[i];
}
printf("%d\n",sum);
}
}
return ;
}

最新文章

  1. win7安装时,避免产生100m系统保留分区的办法
  2. (转帖)开源容器集群管理系统Kubernetes架构及组件介绍
  3. CentOS个人目录下中文路径转英文路径
  4. (最小路径覆盖) News 消息传递 (hust OJ 2604)
  5. addresslist
  6. 让Grub 2来拯救你的 bootloader
  7. Linux top和负载的解释
  8. 1207: C.LU的困惑
  9. POJ 2429 GCD &amp; LCM Inverse(Pollard_Rho+dfs)
  10. untiy 播放视频
  11. HTML 总结-表单-表单属性
  12. git(安装)配置
  13. C# TPL学习
  14. 1详细解析HTML基础结构
  15. JS+html--实现图片轮播
  16. console对象探究
  17. Yii2缓存依赖
  18. spring boot 整合 RabbitMq (注解)
  19. application实例
  20. 浏览器测试string是否为图片

热门文章

  1. git hub 资料汇总
  2. eclipse指定启动时的jdk(xjl456852原创)
  3. iPhone应用提交流程:如何将App程序发布到App Store?
  4. WHY IE AGAIN? - string.charAt(x) or string[x]?
  5. Timus 1796. Amusement Park 聪明题
  6. Laravel 4 Blade模板引擎
  7. SELECT--UNION,UNION ALL,MINUS, INTERSECT,EXISTS
  8. AES算法简介
  9. iptables 实现centos内网机器访问外网
  10. 解析Function.prototype.bind