aoc2021

Advent of Code 2021 solutions in Perl.
git clone git://git.samirparikh.com/aoc2021
Log | Files | Refs | README

commit 1ffe91aef32774bb17524cec9e3ad2648a7c26e2
parent cc2f71fc69025a917d86087025de2cfa4a6f9fb5
Author: Samir Parikh <noreply@samirparikh.com>
Date:   Fri,  3 Dec 2021 15:26:55 +0000

update day03.pl

Diffstat:
Mday03.pl | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/day03.pl b/day03.pl @@ -30,7 +30,7 @@ my $epsilon_rate = ""; foreach (@input) { my @diagnostic = split //; - say join(":", @diagnostic); + #say join(":", @diagnostic); for (0 .. $len) { if ($diagnostic[$_]) { $count_1{$_}++; @@ -40,8 +40,8 @@ foreach (@input) { } } -print Dumper ( \%count_0 ); -print Dumper ( \%count_1 ); +#print Dumper ( \%count_0 ); +#print Dumper ( \%count_1 ); for (0 .. $len) { if ($count_0{$_} > $count_1{$_}) { @@ -53,5 +53,6 @@ for (0 .. $len) { } } -say $gamma_rate; -say $epsilon_rate; +#say $gamma_rate; +#say $epsilon_rate; +say oct("0b" . $gamma_rate) * oct("0b" . $epsilon_rate);