1
0
Fork 0
adventofcode/2016/3/triangle2.py

7 lines
330 B
Python
Executable File

#!/usr/bin/env python3
import sys, re
from itertools import zip_longest
regex = re.compile(r'([0-9]+)')
data = [zip_longest(*([iter(col)] * 3)) for col in zip(*[[int(c) for c in regex.findall(line.strip())] for line in sys.stdin.readlines()])]
print(sum(sum(t[0] + t[1] > t[2] for t in [sorted(t) for t in col]) for col in data))