aboutsummaryrefslogtreecommitdiff
path: root/challenge-079
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-079')
-rw-r--r--challenge-079/cheok-yin-fung/perl/ch-1.pl15
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;