mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-15 01:16:36 +03:00
31 lines
980 B
Python
31 lines
980 B
Python
with open("9.txt") as f:
|
|
rows = [list(map(int, x.split())) for x in f.read().splitlines()]
|
|
cnt = 0
|
|
|
|
for row in rows:
|
|
mx = max(row)
|
|
row_c = row.copy()
|
|
del row_c[row.index(mx)]
|
|
if mx < sum(row_c):
|
|
f = False
|
|
for i in range(4):
|
|
n = [i]
|
|
for j in range(4):
|
|
if j not in n:
|
|
n = [i, j]
|
|
for c in range(4):
|
|
if c not in n:
|
|
n = [i, j, c]
|
|
for d in range(4):
|
|
if d not in n:
|
|
num1 = row[i]
|
|
num2 = row[j]
|
|
num3 = row[c]
|
|
num4 = row[d]
|
|
if num1 + num2 == num3 + num4:
|
|
f = True
|
|
if f:
|
|
cnt += 1
|
|
|
|
print(cnt)
|