4 <meta charset=
"utf-8"/>
5 <title>Day
15 - Advent of Code
</title>
6 <!--[if lt IE 9]><script src="/static/html5.js"></script><![endif]-->
7 <link href='//fonts.googleapis.com/css?family=Source+Code+Pro:
300&subset=latin,latin-ext' rel='stylesheet' type='text/css'
>
8 <link rel=
"stylesheet" type=
"text/css" href=
"/static/style.css?3"/>
9 <link rel=
"shortcut icon" href=
"/favicon.ico?2"/>
15 Oh, hello! Funny seeing you here.
17 I appreciate your enthusiasm, but you aren't going to find much down here.
18 There certainly aren't clues to any of the puzzles. You do risk spoiling a few
19 surprises for yourself, though. Best to play the normal way and discover
20 everything as it was intended, I think. The best surprises don't even appear
21 in the source until you unlock them for real.
23 Please be careful with automated requests; I'm not Google, and I can only take
24 so much traffic. Please be considerate so that everyone gets to play.
26 If you're curious about how Advent of Code works, it's running on some custom
27 Perl code. Other than a few integrations (auth, analytics, ads, social media),
28 I built the whole thing myself, including the design, animations, prose, and
31 The puzzles probably took the longest; the easiest ones were around 45 minutes
32 each, but the harder ones took 2-3 hours, some even longer than that. A lot of
33 effort went into building this thing - I hope you're enjoying playing it as
34 much as I enjoyed making it for you!
36 If you'd like to hang out, I'm @ericwastl on Twitter.
91 <header><h1><a href=
"/">Advent of Code
</a></h1><div class=
"user">Neil Smith
<span class=
"star-count">34*
</span></div><nav><ul><li><a href=
"/about">[About]
</a></li><li><a href=
"/stats">[Stats]
</a></li><li><a href=
"/leaderboard">[Leaderboard]
</a></li><li><a href=
"/settings">[Settings]
</a></li><li><a href=
"/auth/logout">[Log out]
</a></li></ul></nav></header>
94 <script async
src=
"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
95 <!-- Advent of Code Wide Skyscraper -->
96 <ins class=
"adsbygoogle"
97 style=
"display:inline-block;width:160px;height:600px"
98 data-ad-client=
"ca-pub-9420604735624631"
99 data-ad-slot=
"8014013294"></ins>
101 (adsbygoogle = window.adsbygoogle || []).push({});
106 <article class=
"day-desc"><h2>--- Day
15: Science for Hungry People ---
</h2><p>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.
</p>
107 <p>Your recipe leaves room for exactly
<code>100</code> teaspoons of ingredients. You make a list of the
<em>remaining ingredients you could use to finish the recipe
</em> (your puzzle input) and their
<em>properties per teaspoon
</em>:
</p>
109 <li><code>capacity
</code> (how well it helps the cookie absorb milk)
</li>
110 <li><code>durability
</code> (how well it keeps the cookie intact when full of milk)
</li>
111 <li><code>flavor
</code> (how tasty it makes the cookie)
</li>
112 <li><code>texture
</code> (how it improves the feel of the cookie)
</li>
113 <li><code>calories
</code> (how many calories it adds to the cookie)
</li>
115 <p>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
<em>total score
</em> of a cookie can be found by adding up each of the properties (negative totals become
<code>0</code>) and then multiplying together everything except calories.
</p>
116 <p>For instance, suppose you have
<span title=
"* I know what your preference is, but...">these two ingredients
</span>:
</p>
117 <pre><code>Butterscotch: capacity -
1, durability -
2, flavor
6, texture
3, calories
8
118 Cinnamon: capacity
2, durability
3, flavor -
2, texture -
1, calories
3
120 <p>Then, choosing to use
<code>44</code> teaspoons of butterscotch and
<code>56</code> teaspoons of cinnamon (because the amounts of each ingredient must add up to
<code>100</code>) would result in a cookie with the following properties:
</p>
122 <li>A
<code>capacity
</code> of
<code>44*-
1 +
56*
2 =
68</code></li>
123 <li>A
<code>durability
</code> of
<code>44*-
2 +
56*
3 =
80</code></li>
124 <li>A
<code>flavor
</code> of
<code>44*
6 +
56*-
2 =
152</code></li>
125 <li>A
<code>texture
</code> of
<code>44*
3 +
56*-
1 =
76</code></li>
127 <p>Multiplying these together (
<code>68 *
80 *
152 *
76</code>, ignoring
<code>calories
</code> for now) results in a total score of
<code>62842880</code>, 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.
</p>
128 <p>Given the ingredients in your kitchen and their properties, what is the
<em>total score
</em> of the highest-scoring cookie you can make?
</p>
130 <p>Your puzzle answer was
<code>18965440</code>.
</p><article class=
"day-desc"><h2>--- Part Two ---
</h2><p>Your cookie recipe becomes wildly popular! Someone asks if you can make another recipe that has exactly
<code>500</code> calories per cookie (so they can use it as a meal replacement). Keep the rest of your award-winning process the same (
100 teaspoons, same ingredients, same scoring system).
</p>
131 <p>For example, given the ingredients above, if you had instead selected
<code>40</code> teaspoons of butterscotch and
<code>60</code> teaspoons of cinnamon (which still adds to
<code>100</code>), the total calorie count would be
<code>40*
8 +
60*
3 =
500</code>. The total score would go down, though: only
<code>57600000</code>, the best you can do in such trying circumstances.
</p>
132 <p>Given the ingredients in your kitchen and their properties, what is the
<em>total score
</em> of the highest-scoring cookie you can make with a calorie total of
<code>500</code>?
</p>
134 <p>Your puzzle answer was
<code>15862900</code>.
</p><p class=
"day-success">Both parts of this puzzle are complete! They provide two gold stars: **
</p>
135 <p>At this point, you should
<a href=
"/">return to your advent calendar
</a> and try another puzzle.
</p>
136 <p>If you still want to see it, you can
<a href=
"/day/15/input" target=
"_blank">get your puzzle input
</a>.
</p>
137 <p>You can also
<span class=
"share">[Share
<span class=
"share-content">on
138 <a href=
"https://twitter.com/intent/tweet?text=I%27ve+completed+%22Science+for+Hungry+People%22+%2D+Day+15+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F15&related=ericwastl&hashtags=AdventOfCode" target=
"_blank">Twitter
</a>
139 <a href=
"https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F15" target=
"_blank">Google+
</a>
140 <a href=
"http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F15&title=I%27ve+completed+%22Science+for+Hungry+People%22+%2D+Day+15+%2D+Advent+of+Code" target=
"_blank">Reddit
</a
147 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
148 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=
1*new Date();a=s.createElement(o),
149 m=s.getElementsByTagName(o)[
0];a.async=
1;a.src=g;m.parentNode.insertBefore(a,m)
150 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
151 ga('create', 'UA-
69522494-
1', 'auto');
152 ga('send', 'pageview');