aboutsummaryrefslogtreecommitdiff
path: root/challenge-065
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2020-06-22 05:16:00 +0100
committerGitHub <noreply@github.com>2020-06-22 05:16:00 +0100
commit9d64eff3617245597b7af2c8f1ea31852a6b562c (patch)
tree436d53cebf4a90cce752c976094f188af28a0f9f /challenge-065
parent8658c249b025351d8453275dc32f70951b53e7cc (diff)
parent8d2b69ed46164e2ef1c3e25e9b888ab122360573 (diff)
downloadperlweeklychallenge-club-9d64eff3617245597b7af2c8f1ea31852a6b562c.tar.gz
perlweeklychallenge-club-9d64eff3617245597b7af2c8f1ea31852a6b562c.tar.bz2
perlweeklychallenge-club-9d64eff3617245597b7af2c8f1ea31852a6b562c.zip
Merge pull request #1850 from E7-87-83/master
fix bugs on ch-1a.pl
Diffstat (limited to 'challenge-065')
-rw-r--r--challenge-065/cheok-yin-fung/perl/ch-1a.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/challenge-065/cheok-yin-fung/perl/ch-1a.pl b/challenge-065/cheok-yin-fung/perl/ch-1a.pl
index a92567cffd..05c8c57d5d 100644
--- a/challenge-065/cheok-yin-fung/perl/ch-1a.pl
+++ b/challenge-065/cheok-yin-fung/perl/ch-1a.pl
@@ -19,8 +19,9 @@ sub boofoo {
my $start = $_[2]; # $start = 1 if $tf == 1
my $tf = $_[3];
my @ans = ();
+ $start = 0 if $start < 0; #line added after official deadline
+ my $end = ($dSum >= 9 ? 9 : $dSum );
if ($dNumber > 1) {
- my $end = ($dSum >= 9 ? 9 : $dSum );
for my $lfs ($start..$end) { # lfs , shorthand for largest sig fig
for my $baby
(boofoo($dSum-$lfs, $dNumber-1, int ($dSum-$lfs-1)/9, 0)){
@@ -30,8 +31,9 @@ sub boofoo {
}
}
else {
- push @ans, ($dSum != 0 ? $dSum : "0");
- }
+ push @ans, ($dSum != 0 ? $dSum : "0") if $dSum<10;
+ #if condition of above line has been added after official deadline
+ }
return @ans;
}