adventofcode/2018/03/sol1.pl
Yanick Champoux fa9ba00a6b leftovers
2018-12-10 10:32:54 -05:00

16 lines
291 B
Perl

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;