Update readme and lib and start 2015.
This commit is contained in:
22
2015/d1.py
Normal file
22
2015/d1.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from lib import *
|
||||
|
||||
data = open(0).read()
|
||||
|
||||
part_2 = True
|
||||
|
||||
floor = 0
|
||||
for i, c in enumerate(data):
|
||||
if c == "(":
|
||||
floor += 1
|
||||
elif c == ")":
|
||||
floor -= 1
|
||||
else:
|
||||
print(c)
|
||||
assert False
|
||||
|
||||
if part_2 and floor == -1:
|
||||
print(i + 1)
|
||||
break
|
||||
|
||||
if not part_2:
|
||||
print(floor)
|
||||
Reference in New Issue
Block a user