본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 3533번 Explicit Formula

by 현장 2024. 9. 25.

-Code

from itertools import combinations

nums = list(map(int, input().split()))
two = [i|j for i, j in combinations(nums, 2)]
three = [i|j|k for i, j, k in combinations(nums, 3)]
res = 0

for el in two:
    res ^= el

for el in three:
    res ^= el

print(res)