This commit is contained in:
Aéna Aria 2025-12-07 16:19:58 +01:00
parent 41faa54e45
commit bdeef8224d
5 changed files with 469 additions and 0 deletions

22
day7/1.py Normal file
View file

@ -0,0 +1,22 @@
with open(r'day7/input.txt', 'r') as input:
lines = input.read().split('\n')[:-1]
active = set([lines[0].index('S')])
split_cnt = 0
for line in lines[1:]:
active_buf = set()
for i in active:
if line[i] == '^':
if i > 0:
active_buf.add(i-1)
if i < len(line) -1:
active_buf.add(i+1)
split_cnt+=1
else:
active_buf.add(i)
active = active_buf
print(split_cnt)