Day 3: Part 1

This commit is contained in:
2025-12-03 17:58:19 +01:00
parent 4612d8699a
commit 4d1c9c10ed
3 changed files with 362 additions and 0 deletions

134
day3/index.html Normal file
View File

@@ -0,0 +1,134 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8"/>
<title>Day 3 - Advent of Code 2025</title>
<link rel="stylesheet" type="text/css" href="/static/style.css?32"/>
<link rel="stylesheet alternate" type="text/css" href="/static/highcontrast.css?2" title="High Contrast"/>
<link rel="shortcut icon" href="/favicon.png"/>
<script>window.addEventListener('click', function(e,s,r){if(e.target.nodeName==='CODE'&&e.detail===3){s=window.getSelection();s.removeAllRanges();r=document.createRange();r.selectNodeContents(e.target);s.addRange(r);}});</script>
</head><!--
Oh, hello! Funny seeing you here.
I appreciate your enthusiasm, but you aren't going to find much down here.
There certainly aren't clues to any of the puzzles. The best surprises don't
even appear in the source until you unlock them for real.
Please be careful with automated requests; I'm not a massive company, and I can
only take so much traffic. Please be considerate so that everyone gets to play.
If you're curious about how Advent of Code works, it's running on some custom
Perl code. Other than a few integrations (auth, analytics, social media), I
built the whole thing myself, including the design, animations, prose, and all
of the puzzles.
The puzzles are most of the work; preparing a new calendar and a new set of
puzzles takes all of my free time for months every year. A lot of effort went
into building this thing - I hope you're enjoying playing it as much as I
enjoyed making it for you!
If you'd like to hang out, I'm @was.tl on Bluesky and @ericwastl@hachyderm.io
on Mastodon.
- Eric Wastl
-->
<body>
<header><div><h1 class="title-global"><a href="/">Advent of Code</a></h1><nav><ul><li><a href="/2025/about">[About]</a></li><li><a href="/2025/events">[Events]</a></li><li><a href="https://cottonbureau.com/people/advent-of-code" target="_blank">[Shop]</a></li><li><a href="/2025/auth/login">[Log In]</a></li></ul></nav></div><div><h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">0x0000|</span><a href="/2025">2025</a><span class="title-event-wrap"></span></h1><nav><ul><li><a href="/2025">[Calendar]</a></li><li><a href="/2025/support">[AoC++]</a></li><li><a href="/2025/sponsors">[Sponsors]</a></li><li><a href="/2025/leaderboard/private">[Leaderboards]</a></li><li><a href="/2025/stats">[Stats]</a></li></ul></nav></div></header>
<div id="sidebar">
<div id="sponsor"><div class="quiet">Our <a href="/2025/sponsors">sponsors</a> help make Advent of Code possible:</div><div class="sponsor"><a href="/2025/sponsors/redirect?url=https%3A%2F%2Fcareers%2Ecisco%2Ecom%2Fglobal%2Fen%2Fsplunk" target="_blank" onclick="if(ga)ga('send','event','sponsor','sidebar',this.href);" rel="noopener">Splunk, a Cisco Company</a> - Come build a more resilient digital world with us.</div></div>
</div><!--/sidebar-->
<main>
<article class="day-desc"><h2>--- Day 3: Lobby ---</h2><p>You descend a short staircase, enter the surprisingly vast lobby, and are quickly cleared by the security checkpoint. When you get to the main elevators, however, you discover that each one has a red light above it: they're all <em>offline</em>.</p>
<p>"Sorry about that," an Elf apologizes as she tinkers with a nearby control panel. "Some kind of electrical surge seems to have fried them. I'll try to get them online soon."</p>
<p>You explain your need to get further underground. "Well, you could at least take the escalator down to the printing department, not that you'd get much further than that without the elevators working. That is, you could if the escalator weren't also <span title="Escalator temporarily stairs. Sorry for the convenience.">offline</span>."</p>
<p>"But, don't worry! It's not fried; it just needs power. Maybe you can get it running while I keep working on the elevators."</p>
<p>There are batteries nearby that can supply emergency power to the escalator for just such an occasion. The batteries are each labeled with their <a href="/2020/day/10">joltage</a> rating, a value from <code>1</code> to <code>9</code>. You make a note of their joltage ratings (your puzzle input). For example:</p>
<pre><code>987654321111111
811111111111119
234234234234278
818181911112111
</code></pre>
<p>The batteries are arranged into <em>banks</em>; each line of digits in your input corresponds to a single bank of batteries. Within each bank, you need to turn on <em>exactly two</em> batteries; the joltage that the bank produces is equal to the number formed by the digits on the batteries you've turned on. For example, if you have a bank like <code>12345</code> and you turn on batteries <code>2</code> and <code>4</code>, the bank would produce <code>24</code> jolts. (You cannot rearrange batteries.)</p>
<p>You'll need to find the largest possible joltage each bank can produce. In the above example:</p>
<ul>
<li>In <code><em>98</em>7654321111111</code>, you can make the largest joltage possible, <em><code>98</code></em>, by turning on the first two batteries.</li>
<li>In <code><em>8</em>1111111111111<em>9</em></code>, you can make the largest joltage possible by turning on the batteries labeled <code>8</code> and <code>9</code>, producing <em><code>89</code></em> jolts.</li>
<li>In <code>2342342342342<em>78</em></code>, you can make <em><code>78</code></em> by turning on the last two batteries (marked <code>7</code> and <code>8</code>).</li>
<li>In <code>818181<em>9</em>1111<em>2</em>111</code>, the largest joltage you can produce is <em><code>92</code></em>.</li>
</ul>
<p>The total output joltage is the sum of the maximum joltage from each bank, so in this example, the total output joltage is <code>98</code> + <code>89</code> + <code>78</code> + <code>92</code> = <code><em>357</em></code>.</p>
<p>There are many batteries in front of you. Find the maximum joltage possible from each bank; <em>what is the total output joltage?</em></p>
</article>
<p>To play, please identify yourself via one of these services:</p>
<p><a href="/auth/github">[GitHub]</a> <a href="/auth/google">[Google]</a> <a href="/auth/twitter">[Twitter]</a> <a href="/auth/reddit">[Reddit]</a> <span class="quiet">- <a href="/2025/about#faq_auth">[How Does Auth Work?]</a></span></p>
</main>
<!-- ga -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-69522494-1', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
<!-- /ga -->
</body>
</html>