[Python/2016] Move solutions into .py files
This commit is contained in:
parent
0269ad8fc3
commit
2514b1d11f
50 changed files with 1172 additions and 3386 deletions
13
Python/2016/03.py
Normal file
13
Python/2016/03.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
from lib import *
|
||||
|
||||
input = read_input(2016, 3)
|
||||
|
||||
print(sum((y := sorted(map(int, x)))[2] < y[0] + y[1] for x in map(str.split, input.splitlines())))
|
||||
|
||||
|
||||
triangles = [int(b) for a in zip(*map(str.split, input.splitlines())) for b in a]
|
||||
out = 0
|
||||
while triangles:
|
||||
a, b, c = sorted([triangles.pop(0) for _ in "xxx"])
|
||||
out += c < a + b
|
||||
print(out)
|
Loading…
Add table
Add a link
Reference in a new issue