sfdajkl;fsdajkklj;fslj;kds

This commit is contained in:
Skye 2022-12-13 19:06:38 +09:00
parent 43dba6a9d5
commit 200456de89
Signed by: me
GPG key ID: 0104BC05F41B77B8
2 changed files with 2 additions and 21 deletions

6
2.py
View file

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

17
2pt2.py
View file

@ -1,17 +1,2 @@
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)
print(sum([(({(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,}[([int(a) for a in line.strip().split()][0], [int(a) for a in line.strip().split()][1])]) + ((3, 0, 6)[((([int(a) for a in line.strip().split()][0]) - ({(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,}[([int(a) for a in line.strip().split()][0], [int(a) for a in line.strip().split()][1])])) % 3)])) for line in f.readlines()]))