题库练习 XOR Mixup
← 上一题 下一题 →

A15251 | XOR Mixup

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

There is an array $a$ with $n-1$ integers. Let $x$ be the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of all elements of the array. The number $x$ is added to the end of the array $a$ (now it has length $n$ ), and then the elements are shuffled.

You are given the newly formed array $a$ . What is $x$ ? If there are multiple possible values of $x$ , you can output any of them.

输入格式

The input consists of multiple test cases. The first line contains an integer $t$ ( $1 \leq t \leq 1000$ ) — the number of test cases. The description of the test cases follows.

The first line of each test case contains an integer $n$ ( $2 \leq n \leq 100$ ) — the number of integers in the resulting array $a$ .

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ( $0 \le a_i \le 127$ ) — the elements of the newly formed array $a$ .

Additional constraint on the input: the array $a$ is made by the process described in the statement; that is, some value of $x$ exists.

输出格式

For each test case, output a single integer — the value of $x$ , as described in the statement. If there are multiple possible values of $x$ , output any of them.

输入输出样例

输入 #1
4
4
4 3 2 5
5
6 1 10 7 10
6
6 6 6 6 6 6
3
100 100 0
输出 #1
3
7
6
0
C++ 编辑器
输入
输出