aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-016/lakpatashi/README1
-rwxr-xr-xchallenge-016/lakpatashi/perl/ch-1.pl24
2 files changed, 25 insertions, 0 deletions
diff --git a/challenge-016/lakpatashi/README b/challenge-016/lakpatashi/README
new file mode 100644
index 0000000000..bc153bd576
--- /dev/null
+++ b/challenge-016/lakpatashi/README
@@ -0,0 +1 @@
+Solution by lakpatashi
diff --git a/challenge-016/lakpatashi/perl/ch-1.pl b/challenge-016/lakpatashi/perl/ch-1.pl
new file mode 100755
index 0000000000..b08471ddcb
--- /dev/null
+++ b/challenge-016/lakpatashi/perl/ch-1.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Data::Dumper;
+use List::Util qw(sum);
+use feature qw(switch);
+
+#part 1
+my $total = 100000;
+my $maxIdx;
+my $maxPart = 0;
+for my $i (1..100){
+ $i /= 100;
+ my $part = $total*$i;
+ if ($part > $maxPart){
+ $maxPart = $part;
+ $maxIdx = $i*100;
+ }
+ #print "$i ==> $part\n";
+ $total -= $part;
+}
+print "Person $maxIdx gets larger part\n";
+