aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author冯昶 <fengchang@novel-supertv.com>2022-11-30 13:59:05 +0800
committer冯昶 <fengchang@novel-supertv.com>2022-11-30 13:59:05 +0800
commit6411f8424fcbcba2858794c273e931efa91f713d (patch)
treedad86841f752095ebaf475a1ecfdd3855f14f497
parent65c21bd62802060c1018099c5a6090b0eb721130 (diff)
downloadperlweeklychallenge-club-6411f8424fcbcba2858794c273e931efa91f713d.tar.gz
perlweeklychallenge-club-6411f8424fcbcba2858794c273e931efa91f713d.tar.bz2
perlweeklychallenge-club-6411f8424fcbcba2858794c273e931efa91f713d.zip
challenge 193, raku solutions
-rwxr-xr-xchallenge-193/feng-chang/raku/ch-1.raku5
-rwxr-xr-xchallenge-193/feng-chang/raku/ch-2.raku6
2 files changed, 11 insertions, 0 deletions
diff --git a/challenge-193/feng-chang/raku/ch-1.raku b/challenge-193/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..a92861885b
--- /dev/null
+++ b/challenge-193/feng-chang/raku/ch-1.raku
@@ -0,0 +1,5 @@
+#!/bin/env raku
+
+unit sub MAIN(UInt:D \n where * > 0);
+
+put (^2**n)».fmt("\%0{n}b").join(', ');
diff --git a/challenge-193/feng-chang/raku/ch-2.raku b/challenge-193/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..f11eadb1d5
--- /dev/null
+++ b/challenge-193/feng-chang/raku/ch-2.raku
@@ -0,0 +1,6 @@
+#!/bin/env raku
+
+unit sub MAIN(*@S);
+
+my @diffs = @S».comb.map(-> @s { (1..^@S[0].chars).map({ @s[$_].ord - @s[$_-1].ord }).Array });
+put @S[@diffs.grep(-> \df { (^+@S).grep({ df eqv @diffs[$_] }).elems == 1 }, :k)[0]];