aboutsummaryrefslogtreecommitdiff
path: root/2025/07/a.py
diff options
context:
space:
mode:
Diffstat (limited to '2025/07/a.py')
-rw-r--r--2025/07/a.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/2025/07/a.py b/2025/07/a.py
index 5fdb11b..0e13b75 100644
--- a/2025/07/a.py
+++ b/2025/07/a.py
@@ -1,6 +1,19 @@
1import fileinput 1import fileinput
2 2
3with fileinput.input() as lines: 3with fileinput.input() as lines:
4 for line in lines: 4 rows = [line[:-1] for line in lines]
5 ... 5 pos = [rows[0].find('S')]
6 6
7s = 0
8for row in rows[1:]:
9 newpos = set()
10 for p in pos:
11 if row[p] == '^':
12 s += 1
13 newpos.add(p-1)
14 newpos.add(p+1)
15 else:
16 newpos.add(p)
17 pos = list(newpos)
18
19print(s)

Generated with cgit - Back to sebastiano.tronto.net