CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 01:41:23 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=1c45e95b415c435ff0b105e6983850cc72cff9b4003966ee67b84db669633c22a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%220l5ZfuXfC_PSpV0B22qMMxlkCBAMF6s3%22%3B%7D; HttpOnly; Path=/
cf-ray: 98caa7a27ef88cf1-BLR
AoC 2024, day 25, brute force (Perl) - Pastebin.com
SHARE
TWEET

AoC 2024, day 25, brute force (Perl)
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use feature qw(say);
- use List::Util qw(all);
- $/ = '';
- my @locks;
- my @keys;
- foreach my $item (map {[split /\n/]} <>) {
- my @pins;
- foreach my $row (@$item) {
- my @col = split( //, $row );
- foreach my $pin (0 .. 4) {
- $pins[$pin]++ if ($col[$pin] eq '#');
- }
- }
- if ($item->[0] =~ m/^#+$/) {
- push( @locks, \@pins );
- } else {
- push( @keys, \@pins );
- }
- }
- my $part1 = 0;
- foreach my $lock (@locks) {
- foreach my $key (@keys) {
- $part1++ if (all {$key->[$_] + $lock->[$_] <= 7} (0 .. 4));
- }
- }
- say "Part 1: $part1";
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐⭐⭐Instant Profit Method⭐⭐
Java | 7 sec ago | 0.10 KB
-
⭐⭐⭐Profit Method⭐⭐
Java | 18 sec ago | 0.10 KB
-
⭐⭐⭐Make $15OO in 2O minutesV G⭐⭐
Java | 29 sec ago | 0.10 KB
-
⭐⭐⭐MAKE $500 IN 15 MIN⭐⭐
Java | 42 sec ago | 0.10 KB
-
⭐⭐⭐Instant Profit Method⭐⭐
Java | 54 sec ago | 0.10 KB
-
⭐⭐⭐MAKE $900 INSTANTLY⭐⭐
Java | 1 min ago | 0.10 KB
-
⭐⭐⭐MAKE $500 IN 15 MIN⭐⭐
Java | 1 min ago | 0.10 KB
-
⭐⭐⭐Make $1500 in 20 minutes⭐⭐
Java | 1 min ago | 0.10 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand