我们考虑集合中的每个数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 ;
}

hdu 5650 so easy (异或)的更多相关文章

  1. HDU 5650 so easy 数学

    so easy 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5650 Description Given an array with n integ ...

  2. HDU 5650 so easy

    n不为1的时候输出a[1],否则输出0 #include<cstdio> #include<cstring> #include<cmath> #include< ...

  3. 5650 so easy

    so easy  Accepts: 512  Submissions: 1601  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 6553 ...

  4. HDU 5572 An Easy Physics Problem (计算几何+对称点模板)

    HDU 5572 An Easy Physics Problem (计算几何) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5572 Descripti ...

  5. HDU 5650 异或

    so easy Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Sub ...

  6. hdu 5058 So easy

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5058 So easy Description Small W gets two files. Ther ...

  7. hdu 5475 An easy problem(暴力 || 线段树区间单点更新)

    http://acm.hdu.edu.cn/showproblem.php?pid=5475 An easy problem Time Limit: 8000/5000 MS (Java/Others ...

  8. HDU 5475 An easy problem 线段树

    An easy problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...

  9. 数据结构(主席树):HDU 4729 An Easy Problem for Elfness

    An Easy Problem for Elfness Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65535/65535 K (J ...

随机推荐

  1. poj 2046 Gap(bfs+hash)

    Description Let's play a card game called Gap. You have cards labeled with two-digit numbers. The fi ...

  2. Android 体系结构

    Anroid是在Linux基础开发出的一个移动设备开发平台.它自上而下包含四个部分: Application(应用程序) Applicaton Framework(应用程序框架) Libraries& ...

  3. Query语句对系统性能的影响

    需求: 取出某个group(假设id为1)下的用户编号id,用户昵称(nick_name),并按照加入组的时间(user_group.gmt_create)来进行倒序排列,取出前20个 解决方案一: ...

  4. JSON 基本语法

    JSON:JavaScript 对象表示法(JavaScript Object Notation). JSON 是存储和交换文本信息的语法.类似 XML. JSON 比 XML 更小.更快,更易解析. ...

  5. ASP.NET简单文件上传

    一>使用FileUpload控件,将其拖入页面: <%@ Page Title="hehe" Language="C#" MasterPageFil ...

  6. CSS3 div水平、垂直居中,IE9以上、Firefox、Chrome均正常

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  7. mysql学习之五:sql语句学习3

    好吧,大家认为这样的字体还是比較好看,全部我们就换这样的字体了. INSERT INTO 语句用于向表格中插入新的行. 语法 INSERT INTO 表名称 VALUES (值1, 值2,....) ...

  8. Android ActionBar详解(三):ActionBar实现切换Tabs标签

    实现切换Tabs标签; Activity代码: public class ActionBarTabs extends Activity { @Override protected void onCre ...

  9. oracle创建表空间-用户-角色-授权

    1.创建数据表空间: SQL> create tablespace rusky_data datafile 'D:\rusky\rusky_data01,dbf' size 10M autoex ...

  10. [jQuery] 使用jQuery printPage plugin打印其他頁面內容

    目標: 點選按鈕後可以打印其他頁面的內容,可用於套版.內部表單套印...等等. 程式碼: 1.View(HTML布局) <h2>維修申請單</h2> <form id=& ...