27 lines
551 B
Python
27 lines
551 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
|
||
|
|
|
||
|
|
with open("data.txt") as file:
|
||
|
|
lines = [line.rstrip() for line in file]
|
||
|
|
|
||
|
|
summa = 0
|
||
|
|
for line in lines:
|
||
|
|
splitted = line.split(":")
|
||
|
|
splitted = splitted[1].split('|')
|
||
|
|
wins = splitted[0].split(" ")
|
||
|
|
numbers = splitted[1].split(" ")
|
||
|
|
reasumma = 0
|
||
|
|
|
||
|
|
print(wins)
|
||
|
|
print(numbers)
|
||
|
|
for i in numbers:
|
||
|
|
if i == '':
|
||
|
|
continue
|
||
|
|
if i in wins:
|
||
|
|
if reasumma == 0:
|
||
|
|
reasumma = 1
|
||
|
|
else:
|
||
|
|
reasumma *= 2
|
||
|
|
summa += reasumma
|
||
|
|
print(summa)
|