diff --git a/data/example/2025/01.txt b/data/example/2025/01.txt new file mode 100644 index 000000000..53287c7 --- /dev/null +++ b/data/example/2025/01.txt @@ -0,0 +1,10 @@ +L68 +L30 +R48 +L5 +R60 +L55 +L1 +L99 +R14 +L82 diff --git a/src/solution/year_2025/__init__.py b/src/solution/year_2025/__init__.py new file mode 100644 index 000000000..e69de29 diff --git a/src/solution/year_2025/day_01.py b/src/solution/year_2025/day_01.py new file mode 100644 index 000000000..c80e93f --- /dev/null +++ b/src/solution/year_2025/day_01.py @@ -0,0 +1,26 @@ +from typing import Any + + +def part_1_2(input_data) -> Any: + d = 50 + + c1 = 0 + c2 = 0 + + for line in input_data.splitlines(): + dir = 1 if line[0] == "L" else -1 + val = int(line[1:]) + + for _ in range(val): + d = (d + dir) % 100 + if d == 0: + c2 += 1 + + if d == 0: + c1 += 1 + + return c1, c2 + + +def test_part_1_2(example_data) -> None: + assert part_1_2(example_data) == (3, 6)