Added some problem texts
[advent-of-code-19.git] / problems / day04.html
1 <!DOCTYPE html>
2 <html lang="en-us">
3 <head>
4 <meta charset="utf-8"/>
5 <title>Day 4 - Advent of Code 2019</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?23"/>
9 <link rel="stylesheet alternate" type="text/css" href="/static/highcontrast.css?0" title="High Contrast"/>
10 <link rel="shortcut icon" href="/favicon.png"/>
11 </head><!--
12
13
14
15
16 Oh, hello! Funny seeing you here.
17
18 I appreciate your enthusiasm, but you aren't going to find much down here.
19 There certainly aren't clues to any of the puzzles. The best surprises don't
20 even appear in the source until you unlock them for real.
21
22 Please be careful with automated requests; I'm not a massive company, and I can
23 only take so much traffic. Please be considerate so that everyone gets to play.
24
25 If you're curious about how Advent of Code works, it's running on some custom
26 Perl code. Other than a few integrations (auth, analytics, ads, social media),
27 I built the whole thing myself, including the design, animations, prose, and
28 all of the puzzles.
29
30 The puzzles are most of the work; preparing a new calendar and a new set of
31 puzzles each year takes all of my free time for 4-5 months. A lot of effort
32 went into building this thing - I hope you're enjoying playing it as much as I
33 enjoyed making it for you!
34
35 If you'd like to hang out, I'm @ericwastl on Twitter.
36
37 - Eric Wastl
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 -->
89 <body>
90 <header><div><h1 class="title-global"><a href="/">Advent of Code</a></h1><nav><ul><li><a href="/2019/about">[About]</a></li><li><a href="/2019/events">[Events]</a></li><li><a href="https://teespring.com/adventofcode-2019" target="_blank">[Shop]</a></li><li><a href="/2019/settings">[Settings]</a></li><li><a href="/2019/auth/logout">[Log Out]</a></li></ul></nav><div class="user">Neil Smith <a href="/2019/support" class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <span class="star-count">8*</span></div></div><div><h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">0x0000|</span><a href="/2019">2019</a><span class="title-event-wrap"></span></h1><nav><ul><li><a href="/2019">[Calendar]</a></li><li><a href="/2019/support">[AoC++]</a></li><li><a href="/2019/sponsors">[Sponsors]</a></li><li><a href="/2019/leaderboard">[Leaderboard]</a></li><li><a href="/2019/stats">[Stats]</a></li></ul></nav></div></header>
91
92 <div id="sidebar">
93 <div id="sponsor"><div class="quiet">Our <a href="/2019/sponsors">sponsors</a> help make Advent of Code possible:</div><div class="sponsor"><a href="https://www.twilio.com/quest" target="_blank" onclick="if(ga)ga('send','event','sponsor','sidebar',this.href);" rel="noopener">TwilioQuest</a> - Play Advent of Code and earn rad loot in TwilioQuest, a developer RPG for Mac, Windows, and Linux. Learn JavaScript, Python, git, APIs for SMS, VoIP, or WhatsApp, and much more.</div></div>
94 </div><!--/sidebar-->
95
96 <main>
97 <article class="day-desc"><h2>--- Day 4: Secure Container ---</h2><p>You arrive at the Venus fuel depot only to discover it's protected by a password. The Elves had written the password on a sticky note, but someone <span title="Look on the bright side - isn't it more secure if nobody knows the password?">threw it out</span>.</p>
98 <p>However, they do remember a few key facts about the password:</p>
99 <ul>
100 <li>It is a six-digit number.</li>
101 <li>The value is within the range given in your puzzle input.</li>
102 <li>Two adjacent digits are the same (like <code>22</code> in <code>1<em>22</em>345</code>).</li>
103 <li>Going from left to right, the digits <em>never decrease</em>; they only ever increase or stay the same (like <code>111123</code> or <code>135679</code>).</li>
104 </ul>
105 <p>Other than the range rule, the following are true:</p>
106 <ul>
107 <li><code>111111</code> meets these criteria (double <code>11</code>, never decreases).</li>
108 <li><code>2234<em>50</em></code> does not meet these criteria (decreasing pair of digits <code>50</code>).</li>
109 <li><code>123789</code> does not meet these criteria (no double).</li>
110 </ul>
111 <p><em>How many different passwords</em> within the range given in your puzzle input meet these criteria?</p>
112 </article>
113 <p>Your puzzle answer was <code>1955</code>.</p><article class="day-desc"><h2 id="part2">--- Part Two ---</h2><p>An Elf just remembered one more important detail: the two adjacent matching digits <em>are not part of a larger group of matching digits</em>.</p>
114 <p>Given this additional criterion, but still ignoring the range rule, the following are now true:</p>
115 <ul>
116 <li><code>112233</code> meets these criteria because the digits never decrease and all repeated digits are exactly two digits long.</li>
117 <li><code>123<em>444</em></code> no longer meets the criteria (the repeated <code>44</code> is part of a larger group of <code>444</code>).</li>
118 <li><code>111122</code> meets the criteria (even though <code>1</code> is repeated more than twice, it still contains a double <code>22</code>).</li>
119 </ul>
120 <p><em>How many different passwords</em> within the range given in your puzzle input meet all of the criteria?</p>
121 </article>
122 <p>Your puzzle answer was <code>1319</code>.</p><p class="day-success">Both parts of this puzzle are complete! They provide two gold stars: **</p>
123 <p>At this point, you should <a href="/2019">return to your Advent calendar</a> and try another puzzle.</p>
124 <p>Your puzzle input was <code class="puzzle-input">134792-675810</code>.</p>
125 <p>You can also <span class="share">[Share<span class="share-content">on
126 <a href="https://twitter.com/intent/tweet?text=I%27ve+completed+%22Secure+Container%22+%2D+Day+4+%2D+Advent+of+Code+2019&amp;url=https%3A%2F%2Fadventofcode%2Ecom%2F2019%2Fday%2F4&amp;related=ericwastl&amp;hashtags=AdventOfCode" target="_blank">Twitter</a>
127 <a href="javascript:void(0);" onclick="var mastodon_instance=prompt('Mastodon Instance / Server Name?'); if(typeof mastodon_instance==='string' && mastodon_instance.length){this.href='https://'+mastodon_instance+'/share?text=I%27ve+completed+%22Secure+Container%22+%2D+Day+4+%2D+Advent+of+Code+2019+https%3A%2F%2Fadventofcode%2Ecom%2F2019%2Fday%2F4'}else{return false;}" target="_blank">Mastodon</a
128 ></span>]</span> this puzzle.</p>
129 </main>
130
131 <!-- ga -->
132 <script>
133 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
134 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
135 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
136 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
137 ga('create', 'UA-69522494-1', 'auto');
138 ga('set', 'anonymizeIp', true);
139 ga('send', 'pageview');
140 </script>
141 <!-- /ga -->
142 </body>
143 </html>