18 lines
416 B
Python
18 lines
416 B
Python
|
text: str = open("input.txt", "r").read()
|
||
|
|
||
|
import math
|
||
|
|
||
|
value: int = 0
|
||
|
|
||
|
for line in text.split("\n"):
|
||
|
ok = 0
|
||
|
game = line.split(": ")
|
||
|
bozo_dict: dict = {}
|
||
|
for bozo_set in game[1].split("; "):
|
||
|
for cube in bozo_set.split(", "):
|
||
|
values = cube.split(" ")
|
||
|
if (bozo_dict.get(values[1], 0) < int(values[0])):
|
||
|
bozo_dict.update({values[1]: int(values[0])})
|
||
|
value += math.prod(bozo_dict.values())
|
||
|
|
||
|
print(value)
|