diff options
| author | E7-87-83 <fungcheokyin@gmail.com> | 2020-09-28 06:50:08 +0800 |
|---|---|---|
| committer | E7-87-83 <fungcheokyin@gmail.com> | 2020-09-28 06:50:08 +0800 |
| commit | f0715f17cbacbd23b9268f5c8d91a9d1aede18df (patch) | |
| tree | 77ad942f276c3785d3d5b0d3c7072856afbf1dd0 | |
| parent | 1e3ea66bc7f3dbc2226c0a2190b9b32d7f6d81f7 (diff) | |
| download | perlweeklychallenge-club-f0715f17cbacbd23b9268f5c8d91a9d1aede18df.tar.gz perlweeklychallenge-club-f0715f17cbacbd23b9268f5c8d91a9d1aede18df.tar.bz2 perlweeklychallenge-club-f0715f17cbacbd23b9268f5c8d91a9d1aede18df.zip | |
say "laziness" for a week
| -rw-r--r-- | challenge-079/cheok-yin-fung/perl/ch-1.pl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-079/cheok-yin-fung/perl/ch-1.pl b/challenge-079/cheok-yin-fung/perl/ch-1.pl new file mode 100644 index 0000000000..d6f2d0da46 --- /dev/null +++ b/challenge-079/cheok-yin-fung/perl/ch-1.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl +# Perl Weekly Challenge #079 Task 1 +use strict; +use warnings; +use List::Util qw/sum/; +use feature qw/say/; + +my $N; +if ($ARGV[0]) {$N = $ARGV[0];} else {$N = 50;} + +my $ans = 0; #initialize +for (1..$N) { + $ans += sum split //, (sprintf "%0b", $_); +} +say $ans % 1000000007; |
