Created
January 29, 2016 06:59
-
-
Save Abdujabbar/9f29cbef98a77cbd4700 to your computer and use it in GitHub Desktop.
py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t = int(input()) | |
for i in range(t): | |
n = int(input()) | |
a = [int(x) for x in input().split()] | |
_sum = a[0] | |
for i in range(1, n): | |
_sum = _sum ^ a[i] | |
result = _sum | |
step = 2 | |
while step < n: | |
for i in range(n): | |
if n - i >= step: | |
__sum = a[i] | |
for j in range(i + 1, i + step): | |
if j < n: | |
__sum = __sum ^ a[j] | |
_sum = _sum ^ __sum | |
step += 1 | |
print(_sum ^ result) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment