From f5c0c4d52f836f67cadfb496a73c12f814453a7c Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Wed, 11 Dec 2024 10:33:54 +0100 Subject: [PATCH] add 2024/day11 --- 2024/11/main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/2024/11/main.py b/2024/11/main.py index eeb3a88..9bedd6f 100644 --- a/2024/11/main.py +++ b/2024/11/main.py @@ -19,12 +19,14 @@ def blink(stone: str) -> list: return [1] if len(str(stone)) % 2 == 0: + # split stone middle = len(str(stone)) // 2 - first = str(stone)[:middle] - second = str(stone)[middle:] - return [int(first), int(second)] + tens = 10**middle + first = stone // tens + second = stone % tens + return [first, second] - return [int(stone) * 2024] + return [stone * 2024] def solve(stones: dict) -> dict: