编程介的小学生 2019-01-06 21:33 采纳率: 20.5%
浏览 489
已采纳

C语言的问题,看似简单实际上并不简单,这里的集合还有什么没有考虑

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 n different 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}

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分