aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2025/01/b.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/2025/01/b.py b/2025/01/b.py
index ea32dc7..3ef4a9d 100644
--- a/2025/01/b.py
+++ b/2025/01/b.py
@@ -7,13 +7,7 @@ with fileinput.input() as lines:
7 oldp = p 7 oldp = p
8 s = 1 if line[0] == "R" else -1 8 s = 1 if line[0] == "R" else -1
9 p += s * int(line[1:]) 9 p += s * int(line[1:])
10 if p >= 100: 10 c += abs(p) // 100 + (1 if p <= 0 and oldp != 0 else 0)
11 d = p // 100 11 p %= 100
12 c += d
13 p -= d * 100
14 elif p <= 0:
15 d = -p // 100 + 1
16 c += d if oldp != 0 else d-1
17 p = (p + d * 100) % 100
18 12
19print(c) 13print(c)

Generated with cgit - Back to sebastiano.tronto.net