From 56be3bb66222f96b7fdef9c4493ba231a6a2bb92 Mon Sep 17 00:00:00 2001 From: Ysmael Ebreo Date: Mon, 11 May 2020 23:03:51 +0800 Subject: Use variations_with_repetition for task#2 --- challenge-060/yet-ebreo/perl/ch-2.pl | 30 ++++++++++++++++++++++++++---- 1 file 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 -- cgit