aocpy/2016/d3.py
2024-03-18 18:37:24 -04:00

22 lines
594 B
Python

from lib import *
second = True
data = open(0).read()
res = 0
if not second:
for row in data.splitlines():
a, b, c = list(map(int, row.split()))
if a + b > c and a + c > b and b + c > a:
res += 1
else:
rows = list(map(lambda row: row.split(), data.splitlines()))
for coli in range(len(rows[0])):
for rowi in range(0, len(rows), 3):
a = int(rows[rowi][coli])
b = int(rows[rowi + 1][coli])
c = int(rows[rowi + 2][coli])
if a + b > c and a + c > b and b + c > a:
res += 1
print(res)