adventofcode/13/2.pl

24 lines
298 B
Perl
Raw Normal View History

2017-12-13 15:28:31 +00:00
use 5.20.0;
use List::AllUtils qw/ /;
use experimental qw/ signatures postderef /;
my %g = map { split ': ' } <>;
my $i = 1;
until( pass($i) ) {
$i++;
}
say '>>>',$i;
sub pass($i) {
for my $g ( keys %g ) {
return unless ($i+$g) % (2*($g{$g}-1));
}
return 1;
}