Tag 11
my $square = 300 - ($x > $y ? $x : $y); say "check $x $y -> $square"; foreach my $s ( 1 .. $square) { my $total=0; foreach my $x1 ( $x .. $x+$s ) { foreach my $y1 ( $y .. $y+$s) { $total += $grid[$x1][$y1]; } } if ($total > $max) { $max = $total; $maxpos=join(',',$x,$y,$s+1); } }