From bdcdf6f58271008c590ac9157e73c901280d092a Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 1 Dec 2025 06:54:43 +0100 Subject: Day 1 I am stupid and I don't know why --- 2025/01/b.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 2025/01/b.py (limited to '2025/01/b.py') diff --git a/2025/01/b.py b/2025/01/b.py new file mode 100644 index 0000000..ea32dc7 --- /dev/null +++ b/2025/01/b.py @@ -0,0 +1,19 @@ +import fileinput + +p = 50 +c = 0 +with fileinput.input() as lines: + for line in 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 + +print(c) -- cgit v1.3