aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-030/e-choroba/perl5/ch-1.pl26
-rwxr-xr-xchallenge-030/e-choroba/perl5/ch-2.pl19
2 files changed, 45 insertions, 0 deletions
diff --git a/challenge-030/e-choroba/perl5/ch-1.pl b/challenge-030/e-choroba/perl5/ch-1.pl
new file mode 100755
index 0000000000..137e27231c
--- /dev/null
+++ b/challenge-030/e-choroba/perl5/ch-1.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use feature qw{ say };
+
+use Time::Piece;
+
+sub sunday_xmas {
+ my ($year) = @_;
+ return 0 == 'Time::Piece'
+ ->strptime("$year-12-25", '%Y-%m-%d')
+ ->day_of_week
+}
+
+# use Test::More tests => 7;
+# ok sunday_xmas(2022), '25 Dec 2022';
+# ok ! sunday_xmas(2021), '26 Dec 2021';
+# ok ! sunday_xmas(2020), '27 Dec 2020';
+# ok ! sunday_xmas(2025), '28 Dec 2025';
+# ok ! sunday_xmas(2019), '29 Dec 2019';
+# ok ! sunday_xmas(2029), '30 Dec 2029';
+# ok ! sunday_xmas(2023), '31 Dec 2023';
+
+for my $year (2019 .. 2100) {
+ say "25 Dec $year" if sunday_xmas($year);
+}
diff --git a/challenge-030/e-choroba/perl5/ch-2.pl b/challenge-030/e-choroba/perl5/ch-2.pl
new file mode 100755
index 0000000000..5a11614dd5
--- /dev/null
+++ b/challenge-030/e-choroba/perl5/ch-2.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use feature qw{ say };
+
+for my $i (1 .. 10) {
+ for my $j ($i .. 10) {
+ last if $i + $j > 11;
+
+ for my $k ($j .. 10) {
+ last if $i + $j + $k > 12;
+
+ say "$i, $j, $k"
+ if $i + $j + $k == 12
+# && 0 == $i * $j * $k % 2
+ }
+ }
+}
+