From d662d817052767047807f8f1d5643608b9943fa0 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 2 Dec 2025 19:10:49 +0100 Subject: Cleanup day 1 solution --- 2025/01/b.py | 10 ++-------- 1 file 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: oldp = p s = 1 if line[0] == "R" else -1 p += s * int(line[1:]) - if p >= 100: - d = p // 100 - c += d - p -= d * 100 - elif p <= 0: - d = -p // 100 + 1 - c += d if oldp != 0 else d-1 - p = (p + d * 100) % 100 + c += abs(p) // 100 + (1 if p <= 0 and oldp != 0 else 0) + p %= 100 print(c) -- cgit v1.3