adventofcode/2015/14/1.pl
Yanick Champoux 25281404f1 day14
2017-12-06 12:48:31 -05:00

24 lines
434 B
Perl

use 5.20.0;
use List::AllUtils qw/ max/;
use experimental qw/ postderef /;
use List::UtilsBy qw/ max_by /;
my %reindeer =
map { $_->[0] => [ ($_->[1]) x $_->[2], ( 0 ) x $_->[3] ] }
map { [ /(\S+).*?(\d+).*?(\d+).*?(\d+)/ ] } <>;
use DDP;
p %reindeer;
my %score;
for ( 0..2502 ) {
while( my( $r, $s ) = each %reindeer ) {
$score{$r} += $reindeer{$r}[ $_ % $reindeer{$r}->@* ]
}
}
say max values %score;