diff options
| author | 冯昶 <fengchang@novel-supertv.com> | 2023-04-03 18:49:52 +0800 |
|---|---|---|
| committer | 冯昶 <fengchang@novel-supertv.com> | 2023-04-03 18:49:52 +0800 |
| commit | 1b193b53c1db2f37be5ccca5ce8ab4545df4f607 (patch) | |
| tree | f882753470486e67910cf604ece86851d031f61c | |
| parent | 14a919c7618e4160c53a8bfbd6d04e131ebf8e70 (diff) | |
| download | perlweeklychallenge-club-1b193b53c1db2f37be5ccca5ce8ab4545df4f607.tar.gz perlweeklychallenge-club-1b193b53c1db2f37be5ccca5ce8ab4545df4f607.tar.bz2 perlweeklychallenge-club-1b193b53c1db2f37be5ccca5ce8ab4545df4f607.zip | |
challenge 211, raku solutions
| -rwxr-xr-x | challenge-211/feng-chang/raku/ch-1.raku | 16 | ||||
| -rwxr-xr-x | challenge-211/feng-chang/raku/ch-2.raku | 5 | ||||
| -rw-r--r-- | challenge-211/feng-chang/raku/in02.txt | 2 | ||||
| -rw-r--r-- | challenge-211/feng-chang/raku/input.txt | 3 |
4 files changed, 26 insertions, 0 deletions
diff --git a/challenge-211/feng-chang/raku/ch-1.raku b/challenge-211/feng-chang/raku/ch-1.raku new file mode 100755 index 0000000000..318cf8c481 --- /dev/null +++ b/challenge-211/feng-chang/raku/ch-1.raku @@ -0,0 +1,16 @@ +#!/bin/env raku + +unit sub MAIN(Str:D $f where *.IO.e = 'input.txt'); + +my @N = $f.IO.lines.map({ .words».Int.Array }).Array; +my $rows = +@N; +my $cols = +@N[0]; + +my %groups; +for ^$rows -> $r { + for ^$cols -> $c { + %groups{$c-$r}.push([$r, $c]); + } +} + +put +so %groups.keys.map({ [==] %groups{$_}.map({ @N[.[0];.[1]] }) }).all; diff --git a/challenge-211/feng-chang/raku/ch-2.raku b/challenge-211/feng-chang/raku/ch-2.raku new file mode 100755 index 0000000000..0b69977d3a --- /dev/null +++ b/challenge-211/feng-chang/raku/ch-2.raku @@ -0,0 +1,5 @@ +#!/bin/env raku + +unit sub MAIN(*@N); + +put +so @N.combinations».sum.any == @N.sum / 2; diff --git a/challenge-211/feng-chang/raku/in02.txt b/challenge-211/feng-chang/raku/in02.txt new file mode 100644 index 0000000000..9f389471e8 --- /dev/null +++ b/challenge-211/feng-chang/raku/in02.txt @@ -0,0 +1,2 @@ +1 2 3 +3 2 1 diff --git a/challenge-211/feng-chang/raku/input.txt b/challenge-211/feng-chang/raku/input.txt new file mode 100644 index 0000000000..92be5d2071 --- /dev/null +++ b/challenge-211/feng-chang/raku/input.txt @@ -0,0 +1,3 @@ +4 3 2 1 +5 4 3 2 +6 5 4 3 |
