r/adventofcode • • Dec 14 '18

SOLUTION MEGATHREAD -🎄- 2018 Day 14 Solutions -🎄-

--- Day 14: Chocolate Charts ---


Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).

Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Advent of Code: The Party Game!

Click here for rules

Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!

Card prompt: Day 14

Transcript:

The Christmas/Advent Research & Development (C.A.R.D.) department at AoC, Inc. just published a new white paper on ___.


This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

edit: Leaderboard capped, thread unlocked at 00:19:39!

16 Upvotes

179 comments sorted by

View all comments

Show parent comment

1

u/TheoryOfGD Dec 14 '18

My answer wasn't being accepted so I tried this code and got the same answer which still wasn't being accepted and then I tried another answer which still wasn't being accepted. Do you think there is a bug for my input or something? My input was 074501 and I get 2911513541.

5

u/winstonewert Dec 14 '18

This answer isn't going to work for that input because the int in the first line will lose your leading 0.

Are you on part 1 or part 2?

2

u/xiaodaireddit Dec 15 '18

2911513541

I got 6825131659 for part 1

1

u/finn1317 Dec 22 '18 edited Dec 22 '18

I'm working on part 1 and also have a leading 0 for my input. Can you explain why treating it as a string matters, since the question refers to the input as a "number"?

> What are the scores of the ten recipes immediately after the number of recipes in your puzzle input?

EDIT: Nevermind; I forgot that python treats a number with a leading zero as a number in base 8.

1

u/pythondevgb Dec 14 '18

I'm getting 20288091 on your input. I think that if your input contains a leading 0 you have to enter it as a str instead of int.

1

u/CodesLikeChicken Dec 17 '18

Assuming you are checking as new recipes are added, make sure you are checking everything at the end correctly. I had an error because I would resolve new recipes, and then check only what is at the end of my recipe list. When resolving recipes added two digits, I was only checking the very end instead of each digit.

1

u/finn1317 Dec 22 '18 edited Dec 22 '18

I also have a puzzle input with a leading zero, and for part 1, I don't understand why we need to treat it as a string. Were you able to figure this out?

EDIT: Nevermind; I forgot that python treats a number with a leading zero as a number in base 8.