]> www.fi.muni.cz Git - aoc.git/commitdiff
Day 12: look at the input master
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 12 Dec 2025 05:49:35 +0000 (06:49 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 12 Dec 2025 05:49:35 +0000 (06:49 +0100)
2025/23.pl [new file with mode: 0755]

diff --git a/2025/23.pl b/2025/23.pl
new file mode 100755 (executable)
index 0000000..374a385
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w
+
+use v5.42;
+use List::Util qw(sum);
+
+my $sum;
+
+while (<>) {
+       next if !/x/;
+       my ($w, $h, @nshapes) = /\d+/g;
+
+       $w = int($w/3);
+       $h = int($h/3);
+       my $s = sum @nshapes;
+       $sum++ if $s <= $w*$h;
+}
+
+say $sum;