diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-06-21 08:41:41 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-06-21 08:41:41 +0100 |
| commit | 6650027deaab615d1e17eb95b028a2c19e92e04b (patch) | |
| tree | 8294ff10b1a5f2d13fb72e6006ee47b470d7d4ca /challenge-013 | |
| parent | e60228226e7596276db3c14940cb7234b80c9d8a (diff) | |
| download | perlweeklychallenge-club-6650027deaab615d1e17eb95b028a2c19e92e04b.tar.gz perlweeklychallenge-club-6650027deaab615d1e17eb95b028a2c19e92e04b.tar.bz2 perlweeklychallenge-club-6650027deaab615d1e17eb95b028a2c19e92e04b.zip | |
- Added solutions by Maxim Nechaev.
Diffstat (limited to 'challenge-013')
| -rwxr-xr-x | challenge-013/maxim-nechaev/perl5/ch-1.pl | 13 | ||||
| -rwxr-xr-x | challenge-013/maxim-nechaev/perl5/ch-2.pl | 10 |
2 files changed, 23 insertions, 0 deletions
diff --git a/challenge-013/maxim-nechaev/perl5/ch-1.pl b/challenge-013/maxim-nechaev/perl5/ch-1.pl new file mode 100755 index 0000000000..1c31870897 --- /dev/null +++ b/challenge-013/maxim-nechaev/perl5/ch-1.pl @@ -0,0 +1,13 @@ +#!/usr/bin/perl -w +use strict; +use feature 'say'; +use DateTime; + + +my $year = 2019; + +for my $month (1..12) { + my $dt = DateTime->last_day_of_month( year => $year, month => $month ); + $dt->subtract( days => (2 + $dt->dow)%7 ); + say $dt->ymd('/'); +} diff --git a/challenge-013/maxim-nechaev/perl5/ch-2.pl b/challenge-013/maxim-nechaev/perl5/ch-2.pl new file mode 100755 index 0000000000..b83455e1d1 --- /dev/null +++ b/challenge-013/maxim-nechaev/perl5/ch-2.pl @@ -0,0 +1,10 @@ +#!/usr/bin/perl -w +use strict; +use feature 'say'; +no warnings 'recursion'; + +sub F { my $n=shift; $n>0? $n - M(F($n-1)) : 1 } +sub M { my $n=shift; $n>0? $n - F(M($n-1)) : 0 } + +say F(99); # 61 +say M(101); # 63 |
