From 56ca9d19c46bb796b458d36ed64e258d867bbd08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Engl=C3=B6f=20Ytterstr=C3=B6m?= Date: Mon, 1 Dec 2025 08:04:10 +0100 Subject: [PATCH] Solve 2025 day 1 pt 1-2 Brute force, since I was to newly awake to figure out the smart solution. --- 2025-python/output/day_01.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 2025-python/output/day_01.py diff --git a/2025-python/output/day_01.py b/2025-python/output/day_01.py new file mode 100644 index 0000000..a5db17e --- /dev/null +++ b/2025-python/output/day_01.py @@ -0,0 +1,29 @@ +def solve(data): + d = 50 + p1 = 0 + p2 = 0 + for s in data.split(): + sf0 = d == 0 + m, T = (-1, 99) if s[0] == "L" else (1, 1) + for _ in range(int(s[1:])): + d = (d + m) % 100 + if d == T: + if sf0: + sf0 = False + continue + p2 += 1 + p1 += d == 0 + return p1, p1 + p2 + + +if __name__ == "__main__": + with open("./input/01.txt", "r") as f: + inp = f.read().strip() + + p1, p2 = solve(inp) + + print(p1) + print(p2) + + assert p1 == 1195 + assert p2 == 6770