aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-079/jeongoon/perl/ch-2.pl29
-rw-r--r--challenge-079/jeongoon/raku/ch-2.raku3
2 files changed, 17 insertions, 15 deletions
diff --git a/challenge-079/jeongoon/perl/ch-2.pl b/challenge-079/jeongoon/perl/ch-2.pl
index 390c4c625c..7a1882c5ba 100644
--- a/challenge-079/jeongoon/perl/ch-2.pl
+++ b/challenge-079/jeongoon/perl/ch-2.pl
@@ -30,19 +30,19 @@ perl ch-2.pl [--help] [--no-utf8] [--no-color] <N> <N> <N> [ <N>*... ]
=head1 TEST
- perl ch-2.pl --no-colour --no-utf8 2 1 4 1 2 5 6 8 2 1 3 4 8 1 3 2 9 3 7 3
- Total capacity: 50
- 9| #
- 8| # ~ ~ ~ ~ # ~ ~ ~ #
- 7| # ~ ~ ~ ~ # ~ ~ ~ # ~ #
- 6| # # ~ ~ ~ ~ # ~ ~ ~ # ~ #
- 5| # # # ~ ~ ~ ~ # ~ ~ ~ # ~ #
- 4| # ~ ~ # # # ~ ~ ~ # # ~ ~ ~ # ~ #
- 3| # ~ ~ # # # ~ ~ # # # ~ # ~ # # # #
- 2| # ~ # ~ # # # # # ~ # # # ~ # # # # # #
- 1| # # # # # # # # # # # # # # # # # # # #
- `----------------------------------------
- 2 1 4 1 2 5 6 8 2 1 3 4 8 1 3 2 9 3 7 3
+perl ch-2.pl --no-utf8 --no-color 2 1 4 1 2 5 6 8 2 1 3 4 8 1 3 2 9 3 7 3 2 1 3
+Total capacity: 53
+ 9| #
+ 8| # ~ ~ ~ ~ # ~ ~ ~ #
+ 7| # ~ ~ ~ ~ # ~ ~ ~ # ~ #
+ 6| # # ~ ~ ~ ~ # ~ ~ ~ # ~ #
+ 5| # # # ~ ~ ~ ~ # ~ ~ ~ # ~ #
+ 4| # ~ ~ # # # ~ ~ ~ # # ~ ~ ~ # ~ #
+ 3| # ~ ~ # # # ~ ~ # # # ~ # ~ # # # # ~ ~ #
+ 2| # ~ # ~ # # # # # ~ # # # ~ # # # # # # # ~ #
+ 1| # # # # # # # # # # # # # # # # # # # # # # #
+ `----------------------------------------------
+ 2 1 4 1 2 5 6 8 2 1 3 4 8 1 3 2 9 3 7 3 2 1 3
you can try with colour and utf8 option if your terminal is supported.
@@ -156,8 +156,9 @@ for ( my $x = 1; $x < @T; ) {
for (($start+1) .. ($abs_ri-1)) {
$W[$_] = $water_level - $T[$_];
}
+ ( $start, $left ) = ( $x, $T[$x] );
+ ++$x;
}
- last; # no more useful data
}
}
diff --git a/challenge-079/jeongoon/raku/ch-2.raku b/challenge-079/jeongoon/raku/ch-2.raku
index c597609a3d..097a2fa55a 100644
--- a/challenge-079/jeongoon/raku/ch-2.raku
+++ b/challenge-079/jeongoon/raku/ch-2.raku
@@ -53,7 +53,8 @@ given $terri {
if ( my $right = @T[$x..*].pairs.max( *.value ) ) {
@lakes.push( .export-lake( $x+$right.key) );
}
- last; # no more useful data: finish up.
+ ( .start, .left ) = $x, @T[$x];
+ ++$x;
}
}
}