2015 day 1 & 2.

This commit is contained in:
Mikael CAPELLE
2024-01-04 18:27:17 +01:00
parent 52cb793d06
commit ea0c9e7812
6 changed files with 1028 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import sys
line = sys.stdin.read().strip()
floor = 0
floors = [(floor := floor + (1 if c == "(" else -1)) for c in line]
print(f"answer 1 is {floors[-1]}")
print(f"answer 2 is {floors.index(-1)}")