题目链接:

so easy

Time Limit: 2000/1000 MS (Java/Others)  

Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 138    Accepted Submission(s): 110

Problem Description
Given an array with

n

integers, assume f(S) as the result of executing xor operation among all the elements of set S. e.g. if S={1,2,3} then f(S)=0.

your task is: calculate xor of all f(s), here s⊆S.

 
Input
This problem has multi test cases. First line contains a single integer T(T≤20) which represents the number of test cases.
For each test case, the first line contains a single integer number n(1≤n≤1,000) that represents the size of the given set. then the following line consists of ndifferent integer numbers indicate elements(≤109) of the given set.
 
Output
For each test case, print a single integer as the answer.
 
Sample Input
1
3
1 2 3
 
Sample Output
0
In the sample,$S = \{1, 2, 3\}$, subsets of $S$ are: $\varnothing$, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}
题意:问一个集合的所有子集合的异或和的异或和;
思路:因为a^a=0;所以就看代码;
AC代码:
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
const long long mod=1e9+;
int main()
{ int t,n,a[];
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(int i=;i<=n;i++)
{
scanf("%d",&a[i]);
}
if(n==)
{
cout<<a[]<<"\n";
}
else cout<<""<<"\n";
}
return ;
}

hdu-5650 so easy(水题)的更多相关文章

  1. hdu 1106:排序(水题,字符串处理 + 排序)

    排序 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...

  2. HDU 4950 Monster (水题)

    Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a k ...

  3. HDU 4813 Hard Code 水题

    Hard Code Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...

  4. HDU 4593 H - Robot 水题

    H - RobotTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...

  5. HDOJ/HDU 2560 Buildings(嗯~水题)

    Problem Description We divide the HZNU Campus into N*M grids. As you can see from the picture below, ...

  6. HDOJ(HDU) 1859 最小长方形(水题、、)

    Problem Description 给定一系列2维平面点的坐标(x, y),其中x和y均为整数,要求用一个最小的长方形框将所有点框在内.长方形框的边分别平行于x和y坐标轴,点落在边上也算是被框在内 ...

  7. HDU - 1716 排列2 水题

    排列2 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submis ...

  8. HDU—2021-发工资咯(水题,有点贪心的思想)

    作为杭电的老师,最盼望的日子就是每月的8号了,因为这一天是发工资的日子,养家糊口就靠它了,呵呵  但是对于学校财务处的工作人员来说,这一天则是很忙碌的一天,财务处的小胡老师最近就在考虑一个问题:如果每 ...

  9. HDU 5650 so easy 数学

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

  10. hdu 5753 Permutation Bo 水题

    Permutation Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequen ...

随机推荐

  1. vue实践---vue配合express实现请求数据mock

    mock数据是前端比较常见的技术,这里介绍下vue配合express 实现请求数据mock. 第一步: 安装 express :  npm install express -D 第二步: 简历需要mo ...

  2. 利用asset存储mesh

    做mesh导出的时候遇到了这个问题. 最后解决: 存储mesh数据:AssetDatabase.CreateAsset(meshfilter.mesh, "Assets/" + & ...

  3. Lumen开发:结合Redis实现消息队列(1)

    1.简介 Lumen队列服务为各种不同的后台队列提供了统一的API.队列允许你推迟耗时任务(例如发送邮件)的执行,从而大幅提高web请求速度. 1.1 配置 .env文件的QUEUE_DRIVER选项 ...

  4. centos7.0 关闭防火墙

    1.关闭firewall:systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止fire ...

  5. elipse开发环境搭建(Java+C++)

    目的:搭建可用于java和C++开发的eclipse开发环境. 步骤: 1.安装JDK(Java Development Kit):JDK包含了java掩饰程序和样例.Java公共API类的源代码.J ...

  6. wxwidget自定义消息处理步骤

    from http://www.cppblog.com/kenlistian/archive/2009/02/06/73096.html 略有修改 wxwidget自定义消息处理步骤 自定义消息处理( ...

  7. EF之POCO应用系列3——延迟加载

    EF之POCO应用系列4——延迟加载 当我们进行查询的时候,哪些关系的数据将会被加载到内存呢?所有相关的对象都需要吗?在一些场合可能有意义,例如,当查询的实体仅仅拥有一个相关的子实体,但是,多数情况下 ...

  8. OC常用函数及变量

    1.OC常用的的函数及变量 (1)算术函数 [算术函数] 函数名 说明 int rand() 随机数生成.(例)srand(time(nil)); //随机数初期化int val = rand()P; ...

  9. opengl绘制图片

    #include <GL/glew.h>#include <glut.h>#include "FreeImage.h"#include <stdio. ...

  10. (转)Javascript模块化编程(一):模块的写法

    随着网站逐渐变成"互联网应用程序",嵌入网页的Javascript代码越来越庞大,越来越复杂. 网页越来越像桌面程序,需要一个团队分工协作.进度管理.单元测试等等......开发者 ...