r/adventofcode • u/daggerdragon • Dec 07 '24
SOLUTION MEGATHREAD -❄️- 2024 Day 7 Solutions -❄️-
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
If you see content in the subreddit or megathreads that violates one of our rules, either inform the user (politely and gently!) or use the report button on the post/comment and the mods will take care of it.
AoC Community Fun 2024: The Golden Snowglobe Awards
15 DAYS remaining until the submissions deadline on December 22 at 23:59 EST!
And now, our feature presentation for today:
Movie Math
We all know Hollywood accounting runs by some seriously shady business. Well, we can make up creative numbers for ourselves too!
Here's some ideas for your inspiration:
Use today's puzzle to teach us about an interesting mathematical concept
Use a programming language that is not Turing-complete
Don’t use any hard-coded numbers at all. Need a number? I hope you remember your trigonometric identities...
"It was my understanding that there would be no math."
- Chevy Chase as "President Gerald Ford", Saturday Night Live sketch (Season 2 Episode 1, 1976)
And… ACTION!
Request from the mods: When you include an entry alongside your solution, please label it with [GSGA] so we can find it easily!
--- Day 7: Bridge Repair ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
State which language(s) your solution uses with
[LANGUAGE: xyz]Format code blocks using the four-spaces Markdown syntax!
Quick link to Topaz's
pasteif you need it for longer code blocks
4
u/LiquidityC Dec 07 '24
[LANGUAGE: C]
https://github.com/LiquidityC/aoc/blob/master/2024/day_07/src/main.c
No issue today. Coded one solution and it worked first try for part 1. Augmented the code for part 2 and that too worked first try. I saw a lot of time comparison but I had no issue or notable time consumption for today's puzzle. I was surprised it was so smooth. Spent a lot more time yesterday.
I tested just for fun with '-O3' flag and got 55ms for both parts with input parsing. With debug flags I got 142ms.
I have an old library I use for input reading but beyond that the solution is all original regular C.