1
0
Fork 0

03: Slightly smaller Python

This commit is contained in:
Mia Herkt 2022-12-04 00:35:13 +01:00
parent b2a7be43ea
commit 83fa5d8bea
Signed by: mia
GPG Key ID: 72E154B8622EC191
1 changed files with 2 additions and 2 deletions

View File

@ -3,8 +3,8 @@
import sys
S = G = 0
for l in zip(*[iter(list(map(lambda c: c - ord('A') + 27 if c < ord('a') else c - ord('a') + 1, map(ord, x.strip()))) for x in sys.stdin)] * 3):
for l in zip(*[iter(list(map(lambda c: c - 38 if c < 97 else c - 96, map(ord, x.strip()))) for x in sys.stdin)] * 3):
G += set.intersection(*map(set, l)).pop()
S += sum(set(x[:int(len(x) / 2)]).intersection(x[int(len(x) / 2):]).pop() for x in l)
S += sum(set(x[:len(x) // 2]).intersection(x[len(x) // 2:]).pop() for x in l)
print(f"Silver: {S}\nGold: {G}")