mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-22 11:56:33 +03:00
24 lines
513 B
Python
Vendored
24 lines
513 B
Python
Vendored
with open("9.txt") as f:
|
|
data = f.read().splitlines()
|
|
|
|
nums = [list(map(int, x.split())) for x in data]
|
|
|
|
count = 0
|
|
|
|
for row in nums:
|
|
n = [row.count(x) for x in row]
|
|
if n.count(3) == 3 and n.count(1) == 3:
|
|
ns = [(x, row.count(x)) for x in row]
|
|
nr = 0
|
|
mr = 0
|
|
for n, c in ns:
|
|
if c == 3:
|
|
nr += n
|
|
else:
|
|
mr += n
|
|
if mr / 3 < nr:
|
|
count += 1
|
|
print(row)
|
|
|
|
print(count)
|