diff options
| author | Ysmael Ebreo <Ysmael.Ebreo@latticesemi.com> | 2020-05-11 23:03:51 +0800 |
|---|---|---|
| committer | Ysmael Ebreo <Ysmael.Ebreo@latticesemi.com> | 2020-05-11 23:03:51 +0800 |
| commit | 56be3bb66222f96b7fdef9c4493ba231a6a2bb92 (patch) | |
| tree | 4ce612b4b25c300162085bc33113d8e7c7063bd5 | |
| parent | 1bd06dd5ebbb420d3eba4335a8d2c6b4d4eea520 (diff) | |
| download | perlweeklychallenge-club-56be3bb66222f96b7fdef9c4493ba231a6a2bb92.tar.gz perlweeklychallenge-club-56be3bb66222f96b7fdef9c4493ba231a6a2bb92.tar.bz2 perlweeklychallenge-club-56be3bb66222f96b7fdef9c4493ba231a6a2bb92.zip | |
Use variations_with_repetition for task#2
| -rw-r--r-- | challenge-060/yet-ebreo/perl/ch-2.pl | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/challenge-060/yet-ebreo/perl/ch-2.pl b/challenge-060/yet-ebreo/perl/ch-2.pl index 79ec00f0a4..86162de50f 100644 --- a/challenge-060/yet-ebreo/perl/ch-2.pl +++ b/challenge-060/yet-ebreo/perl/ch-2.pl @@ -2,7 +2,7 @@ use strict; use warnings; use feature 'say'; -use Algorithm::Combinatorics qw(variations); +use Algorithm::Combinatorics qw(variations_with_repetition); my @L = (0, 1, 2, 5); my $X = 2; @@ -15,11 +15,12 @@ if (@ARGV > 2) { say @{$_} for grep { (($X == length ($% = join "",@{$_})) && ($% < $Y)) -} variations(\@L,$X); +} variations_with_repetition(\@L,$X); =begin -perl .\ch-2.pl +perl .\ch-2.pl 10 +11 12 15 20 @@ -29,22 +30,43 @@ perl .\ch-2.pl 0 1 3 9 1 5 1 3 -perl .\ch-2.pl 0 1 3 9 2 20 +perl .\ch-2.pl 0 1 3 9 2 20 10 +11 13 19 perl .\ch-2.pl 0 1 3 9 3 600 +100 +101 103 109 +110 +111 +113 +119 130 +131 +133 139 190 +191 193 +199 +300 301 +303 309 310 +311 +313 319 +330 +331 +333 +339 390 391 +393 +399 =cut
\ No newline at end of file |
