Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2015] [Day 15]: Science for Hungry People #15

Open
victoraugustofd opened this issue Dec 22, 2024 · 0 comments
Open

[2015] [Day 15]: Science for Hungry People #15

victoraugustofd opened this issue Dec 22, 2024 · 0 comments
Assignees
Labels
puzzle Advent of Code challenge
Milestone

Comments

@victoraugustofd
Copy link
Owner

victoraugustofd commented Dec 22, 2024

Challenge description

Today, you set out on the task of perfecting your milk-dunking cookie recipe. All you have to do is find the right balance of ingredients.

Your recipe leaves room for exactly 100 teaspoons of ingredients. You make a list of the remaining ingredients you could use to finish the recipe (your puzzle input) and their properties per teaspoon:

  • capacity (how well it helps the cookie absorb milk)
  • durability (how well it keeps the cookie intact when full of milk)
  • flavor (how tasty it makes the cookie)
  • texture (how it improves the feel of the cookie)
  • calories (how many calories it adds to the cookie)

You can only measure ingredients in whole-teaspoon amounts accurately, and you have to be accurate so you can reproduce your results in the future. The total score of a cookie can be found by adding up each of the properties (negative totals become 0) and then multiplying together everything except calories.

For instance, suppose you have these two ingredients:

Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8
Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3
Then, choosing to use 44 teaspoons of butterscotch and 56 teaspoons of cinnamon (because the amounts of each ingredient must add up to 100) would result in a cookie with the following properties:

  • A capacity of 44 * -1 + 56 * 2 = 68
  • A durability of 44 * -2 + 56 * 3 = 80
  • A flavor of 44 * 6 + 56 * -2 = 152
  • A texture of 44 * 3 + 56 * -1 = 76

Multiplying these together (68 * 80 * 152 * 76, ignoring calories for now) results in a total score of 62842880, which happens to be the best score possible given these ingredients. If any properties had produced a negative total, it would have instead become zero, causing the whole score to multiply to zero.

Given the ingredients in your kitchen and their properties, what is the total score of the highest-scoring cookie you can make?

Challenge input

Frosting: capacity 4, durability -2, flavor 0, texture 0, calories 5
Candy: capacity 0, durability 5, flavor -1, texture 0, calories 8
Butterscotch: capacity -1, durability 0, flavor 5, texture 0, calories 6
Sugar: capacity 0, durability 0, flavor -2, texture 2, calories 1

Challenge year

2015

Challenge link

https://adventofcode.com/2015/day/15

@victoraugustofd victoraugustofd added the puzzle Advent of Code challenge label Dec 22, 2024
@victoraugustofd victoraugustofd self-assigned this Dec 22, 2024
@victoraugustofd victoraugustofd added this to the 2015 Challenges milestone Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
puzzle Advent of Code challenge
Projects
Status: Backlog
Development

No branches or pull requests

1 participant