adventofcode/2018/03/sol1.pl

16 lines
291 B
Perl
Raw Normal View History

2018-12-10 15:32:54 +00:00
use 5.20.0;
my @clothe;
while( <> ) {
/(?<x>\d+),(?<y>\d+): (?<w>\d+)x(?<h>\d+)/ or die;
for my $x ( $+{x}...$+{x}+$+{w}-1 ) {
for my $y ( $+{y}...$+{y}+$+{h}-1 ) {
$clothe[$x][$y]++
}
}
}
say scalar grep { $_ > 1 } map { $_ ? @$_ : () } @clothe;