ABC
E
XOR
ABC171 E - Red Scarf
https://atcoder.jp/contests/abc171/tasks/abc171_e (opens in a new tab)
่ถ่ฒไธไฝใXOR
ไธใใใใ ใฏๆฌกใฎใใใซ่กจ็พใงใใใ
่พบใ ใ XOR ใใใจใ ใๅพใใใๅถ็ดใใใๅ ใฏ ๅใฎๅฅๆฐๅๅญๅจใใใฎใงใ ใจใชใใ
ใใใง ใจใใใ
ไธใฎ ใฎๅผใ้ ใซๅ ใใใจใ ใๅฉ็จใใใจไธๅผใฏใ ใจ ใๆฑใใไบใๅบๆฅใใไปใฎ ใๅๆงใซใใฆๆฑใพใใ
import functools
import operator
n = int(input())
a = list(map(int, input().split()))
x = functools.reduce(operator.xor, a)
for e in a:
print(x ^ e)
่ฃ่ถณ: XOR ใฎๆง่ณช ๅฏๆ ๅถๆฐๅ่ถณใใจ 0 ใซใชใ ๅฅๆฐๅ่ถณใใจๅ ใซๆปใ