diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2019-10-14 16:42:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-14 16:42:25 +0100 |
| commit | e1385f4479c2f3dbfa6c82161b1946ecd8215ed5 (patch) | |
| tree | 2fc190c8060d21d648ea7bd24224872bb6a0535b /challenge-030 | |
| parent | f89d0a589d717c04ddde35814e96d78fff7b1e82 (diff) | |
| parent | 78f9e6a94b9d471e10dc726caa1d6684d2995876 (diff) | |
| download | perlweeklychallenge-club-e1385f4479c2f3dbfa6c82161b1946ecd8215ed5.tar.gz perlweeklychallenge-club-e1385f4479c2f3dbfa6c82161b1946ecd8215ed5.tar.bz2 perlweeklychallenge-club-e1385f4479c2f3dbfa6c82161b1946ecd8215ed5.zip | |
Merge pull request #773 from Doomtrain14/master
Update ch#30-2 solution
Diffstat (limited to 'challenge-030')
| -rw-r--r-- | challenge-030/yet-ebreo/perl5/ch-2.pl | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/challenge-030/yet-ebreo/perl5/ch-2.pl b/challenge-030/yet-ebreo/perl5/ch-2.pl index 15a9bad22a..87a22ba2ef 100644 --- a/challenge-030/yet-ebreo/perl5/ch-2.pl +++ b/challenge-030/yet-ebreo/perl5/ch-2.pl @@ -8,12 +8,15 @@ use strict; use warnings; use feature 'say'; -for (0..999) { - my $n = sprintf "%03d",$_; - ($n =~/[0248]/) && (12==(map {1..$_}$n=~/./g)) && say $n=~s/.\B/$&,/gr; -} +my $r = join ",", 0..12; +eval==12 && /[02468]\+/ && say y/+/,/r while glob "{$r}+{$r}+{$r}"; + + =begin perl .\ch-2.pl +0,0,12 +0,1,11 +0,2,10 0,3,9 0,4,8 0,5,7 @@ -21,12 +24,16 @@ perl .\ch-2.pl 0,7,5 0,8,4 0,9,3 +0,10,2 +0,11,1 +0,12,0 +1,0,11 1,2,9 -1,3,8 1,4,7 -1,7,4 +1,6,5 1,8,3 -1,9,2 +1,10,1 +2,0,10 2,1,9 2,2,8 2,3,7 @@ -36,14 +43,12 @@ perl .\ch-2.pl 2,7,3 2,8,2 2,9,1 +2,10,0 3,0,9 -3,1,8 3,2,7 3,4,5 -3,5,4 -3,7,2 +3,6,3 3,8,1 -3,9,0 4,0,8 4,1,7 4,2,6 @@ -55,27 +60,28 @@ perl .\ch-2.pl 4,8,0 5,0,7 5,2,5 -5,3,4 5,4,3 -5,5,2 -5,7,0 +5,6,1 6,0,6 +6,1,5 6,2,4 +6,3,3 6,4,2 +6,5,1 6,6,0 7,0,5 -7,1,4 7,2,3 -7,3,2 7,4,1 -7,5,0 8,0,4 8,1,3 8,2,2 8,3,1 8,4,0 9,0,3 -9,1,2 9,2,1 -9,3,0 +10,0,2 +10,1,1 +10,2,0 +11,0,1 +12,0,0 =cut
\ No newline at end of file |
