You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
424 B

2 years ago
with open("input2_pre.txt") as f:
s = 0
for line in f.readlines():
a, b = [int(a) for a in line.strip().split()]
b = {
(1, 1): 3,
(1, 2): 1,
(1, 3): 2,
(2, 1): 1,
(2, 2): 2,
(2, 3): 3,
(3, 1): 2,
(3, 2): 3,
(3, 3): 1,
}[(a, b)]
s += b + ((3, 0, 6)[((a - b) % 3)])
print(s)