diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-09-26 19:13:18 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-09-26 19:13:18 +0100 |
| commit | b8f3392f3f84c945d07c33a189c99211b9ea62a0 (patch) | |
| tree | 41402c2b7b10f0a50b395402bdb12aa8c6fb4d21 | |
| parent | 9aecbb345e1f25fed56f667b0ea1ae9e6e05bf77 (diff) | |
| download | perlweeklychallenge-club-b8f3392f3f84c945d07c33a189c99211b9ea62a0.tar.gz perlweeklychallenge-club-b8f3392f3f84c945d07c33a189c99211b9ea62a0.tar.bz2 perlweeklychallenge-club-b8f3392f3f84c945d07c33a189c99211b9ea62a0.zip | |
- Added solutions by Pete Houston.
| -rw-r--r-- | challenge-079/pete-houston/perl/ch-1.pl | 35 | ||||
| -rw-r--r-- | challenge-079/pete-houston/perl/ch-2.pl | 50 | ||||
| -rw-r--r-- | stats/pwc-current.json | 511 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 52 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 600 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 736 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 104 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 36 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 66 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 126 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 34 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 36 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 414 |
14 files changed, 1470 insertions, 1370 deletions
diff --git a/challenge-079/pete-houston/perl/ch-1.pl b/challenge-079/pete-houston/perl/ch-1.pl new file mode 100644 index 0000000000..136d10f7d4 --- /dev/null +++ b/challenge-079/pete-houston/perl/ch-1.pl @@ -0,0 +1,35 @@ +#!/usr/bin/env perl +#=============================================================================== +# +# FILE: 7901.pl +# +# USAGE: ./7901.pl N +# +# DESCRIPTION: Given N as decimal, total the 1 bits in all the binary +# numbers from 1 to N. +# +# REQUIREMENTS: Params::Util, Bit::Manip +# NOTES: The modulo was specified in the task. +# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk +# ORGANIZATION: Openstrike +# VERSION: 1.0 +# CREATED: 22/09/20 +#=============================================================================== + +use strict; +use warnings; + +use Params::Util '_POSINT'; +use Bit::Manip 'bit_count'; + +my $n = shift; + +# Validate +die "'$n' is not a natural number.\n" unless _POSINT ($n); + +# Count the sum of the 1 bits +my $tot = 0; +$tot += bit_count ($target, 1) for (1 .. $n); + +# Output +print $tot % 1000000007 . "\n"; diff --git a/challenge-079/pete-houston/perl/ch-2.pl b/challenge-079/pete-houston/perl/ch-2.pl new file mode 100644 index 0000000000..88aad4e02f --- /dev/null +++ b/challenge-079/pete-houston/perl/ch-2.pl @@ -0,0 +1,50 @@ +#!/usr/bin/env perl +#=============================================================================== +# +# FILE: 7902.pl +# +# USAGE: ./7902.pl N ... +# +# DESCRIPTION: Histogram capacity +# +# REQUIREMENTS: List::Util +# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk +# ORGANIZATION: Openstrike +# VERSION: 1.0 +# CREATED: 22/09/20 +#=============================================================================== + +use strict; +use warnings; +use List::Util 'max'; + +print_histo (@ARGV); +histo_capacity (@ARGV); + +sub histo_capacity { + my @in = @_; + my $start = shift @in; + my $capacity = 0; + while (my $next = shift @in) { + last unless scalar @in; + my $max = max (@in); + $start = $max if $max < $start; + if ($next < $start) { + $capacity += $start - $next; + next; + } + $start = $next; + } + print "\nCapacity is $capacity\n"; +} + +sub print_histo { + my @y = @_; + my $yval = max (@y); + while ($yval) { + printf "\%6i\%s\n", + $yval, join '', map { $_ >= $yval ? ' #' : ' ' } @y; + $yval--; + } + print ' ' x 4, ' _' x (1 + @y), "\n @y\n"; +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 517e6ae0e4..c17284dc86 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -2,6 +2,193 @@ "title" : { "text" : "Perl Weekly Challenge - 079" }, + "xAxis" : { + "type" : "category" + }, + "tooltip" : { + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", + "followPointer" : 1 + }, + "legend" : { + "enabled" : 0 + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "chart" : { + "type" : "column" + }, + "series" : [ + { + "name" : "Perl Weekly Challenge - 079", + "data" : [ + { + "drilldown" : "Abigail", + "y" : 2, + "name" : "Abigail" + }, + { + "drilldown" : "Andrew Shitov", + "name" : "Andrew Shitov", + "y" : 2 + }, + { + "y" : 4, + "name" : "Athanasius", + "drilldown" : "Athanasius" + }, + { + "drilldown" : "Bob Lied", + "y" : 2, + "name" : "Bob Lied" + }, + { + "drilldown" : "Colin Crain", + "y" : 1, + "name" : "Colin Crain" + }, + { + "name" : "Cristina Heredia", + "y" : 1, + "drilldown" : "Cristina Heredia" + }, + { + "drilldown" : "Daniel Mantovani", + "name" : "Daniel Mantovani", + "y" : 4 + }, + { + "name" : "Dave Cross", + "y" : 2, + "drilldown" : "Dave Cross" + }, + { + "y" : 2, + "name" : "Dave Jacoby", + "drilldown" : "Dave Jacoby" + }, + { + "name" : "E. Choroba", + "y" : 2, + "drilldown" : "E. Choroba" + }, + { + "drilldown" : "Flavio Poletti", + "y" : 4, + "name" : "Flavio Poletti" + }, + { + "drilldown" : "James Smith", + "y" : 2, + "name" : "James Smith" + }, + { + "y" : 2, + "name" : "Jorg Sommrey", + "drilldown" : "Jorg Sommrey" + }, + { + "name" : "Julio de Castro", + "y" : 4, + "drilldown" : "Julio de Castro" + }, + { + "y" : 2, + "name" : "Kang-min Liu", + "drilldown" : "Kang-min Liu" + }, + { + "name" : "Laurent Rosenfeld", + "y" : 5, + "drilldown" : "Laurent Rosenfeld" + }, + { + "name" : "Leo Manfredi", + "y" : 1, + "drilldown" : "Leo Manfredi" + }, + { + "name" : "Lubos Kolouch", + "y" : 2, + "drilldown" : "Lubos Kolouch" + }, + { + "drilldown" : "Mark Anderson", + "y" : 2, + "name" : "Mark Anderson" + }, + { + "name" : "Markus Holzer", + "y" : 2, + "drilldown" : "Markus Holzer" + }, + { + "name" : "Mohammad S Anwar", + "y" : 4, + "drilldown" : "Mohammad S Anwar" + }, + { + "y" : 5, + "name" : "Myoungjin Jeon", + "drilldown" : "Myoungjin Jeon" + }, + { + "name" : "Niels van Dijke", + "y" : 2, + "drilldown" : "Niels van Dijke" + }, + { + "name" : "Nuno Vieira", + "y" : 2, + "drilldown" : "Nuno Vieira" + }, + { + "drilldown" : "Pete Houston", + "name" : "Pete Houston", + "y" : 2 + }, + { + "y" : 1, + "name" : "Rakulius", + "drilldown" : "Rakulius" + }, + { + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West", + "y" : 5 + }, + { + "drilldown" : "Simon Proctor", + "y" : 2, + "name" : "Simon Proctor" + }, + { + "drilldown" : "Steven Wilson", + "name" : "Steven Wilson", + "y" : 3 + }, + { + "name" : "Ulrich Rieke", + "y" : 3, + "drilldown" : "Ulrich Rieke" + }, + { + "y" : 1, + "name" : "Vinod Kumar K", + "drilldown" : "Vinod Kumar K" + }, + { + "drilldown" : "Walt Mankowski", + "y" : 3, + "name" : "Walt Mankowski" + } + ], + "colorByPoint" : 1 + } + ], "drilldown" : { "series" : [ { @@ -21,10 +208,12 @@ 2 ] ], - "id" : "Andrew Shitov", - "name" : "Andrew Shitov" + "name" : "Andrew Shitov", + "id" : "Andrew Shitov" }, { + "id" : "Athanasius", + "name" : "Athanasius", "data" : [ [ "Perl", @@ -34,41 +223,40 @@ "Raku", 2 ] - ], - "id" : "Athanasius", - "name" : "Athanasius" + ] }, { - "name" : "Bob Lied", "id" : "Bob Lied", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Bob Lied" }, { - "name" : "Colin Crain", "data" : [ [ "Blog", 1 ] ], + "name" : "Colin Crain", "id" : "Colin Crain" }, { - "id" : "Cristina Heredia", + "name" : "Cristina Heredia", "data" : [ [ "Perl", 1 ] ], - "name" : "Cristina Heredia" + "id" : "Cristina Heredia" }, { + "id" : "Daniel Mantovani", "name" : "Daniel Mantovani", "data" : [ [ @@ -79,40 +267,40 @@ "Blog", 2 ] - ], - "id" : "Daniel Mantovani" + ] }, { "name" : "Dave Cross", - "id" : "Dave Cross", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Dave Cross" }, { + "id" : "Dave Jacoby", + "name" : "Dave Jacoby", "data" : [ [ "Perl", 2 ] - ], - "id" : "Dave Jacoby", - "name" : "Dave Jacoby" + ] }, { + "name" : "E. Choroba", "data" : [ [ "Perl", 2 ] ], - "id" : "E. Choroba", - "name" : "E. Choroba" + "id" : "E. Choroba" }, { + "id" : "Flavio Poletti", "data" : [ [ "Perl", @@ -123,17 +311,16 @@ 2 ] ], - "id" : "Flavio Poletti", "name" : "Flavio Poletti" }, { - "name" : "James Smith", "data" : [ [ "Perl", 2 ] ], + "name" : "James Smith", "id" : "James Smith" }, { @@ -143,12 +330,10 @@ 2 ] ], - "id" : "Jorg Sommrey", - "name" : "Jorg Sommrey" + "name" : "Jorg Sommrey", + "id" : "Jorg Sommrey" }, { - "name" : "Julio de Castro", - "id" : "Julio de Castro", "data" : [ [ "Perl", @@ -158,17 +343,19 @@ "Raku", 2 ] - ] + ], + "name" : "Julio de Castro", + "id" : "Julio de Castro" }, { - "name" : "Kang-min Liu", "id" : "Kang-min Liu", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Kang-min Liu" }, { "id" : "Laurent Rosenfeld", @@ -189,47 +376,47 @@ "name" : "Laurent Rosenfeld" }, { - "name" : "Leo Manfredi", + "id" : "Leo Manfredi", "data" : [ [ "Perl", 1 ] ], - "id" : "Leo Manfredi" + "name" : "Leo Manfredi" }, { + "name" : "Lubos Kolouch", "data" : [ [ "Perl", 2 ] ], - "id" : "Lubos Kolouch", - "name" : "Lubos Kolouch" + "id" : "Lubos Kolouch" }, { - "name" : "Mark Anderson", + "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "id" : "Mark Anderson" + "name" : "Mark Anderson" }, { "name" : "Markus Holzer", - "id" : "Markus Holzer", "data" : [ [ "Raku", 2 ] - ] + ], + "id" : "Markus Holzer" }, { - "name" : "Mohammad S Anwar", + "id" : "Mohammad S Anwar", "data" : [ [ "Perl", @@ -240,9 +427,10 @@ 2 ] ], - "id" : "Mohammad S Anwar" + "name" : "Mohammad S Anwar" }, { + "name" : "Myoungjin Jeon", "data" : [ [ "Perl", @@ -257,18 +445,27 @@ 1 ] ], - "id" : "Myoungjin Jeon", - "name" : "Myoungjin Jeon" + "id" : "Myoungjin Jeon" }, { "id" : "Niels van Dijke", + "name" : "Niels van Dijke", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { "data" : [ [ "Perl", 2 ] ], - "name" : "Niels van Dijke" + "name" : "Nuno Vieira", + "id" : "Nuno Vieira" }, { "data" : [ @@ -277,20 +474,22 @@ 2 ] ], - "id" : "Nuno Vieira", - "name" : "Nuno Vieira" + "name" : "Pete Houston", + "id" : "Pete Houston" }, { + "name" : "Rakulius", "data" : [ [ "Raku", 1 ] ], - "id" : "Rakulius", - "name" : "Rakulius" + "id" : "Rakulius" }, { + "id" : "Roger Bell_West", + "name" : "Roger Bell_West", "data" : [ [ "Perl", @@ -304,21 +503,21 @@ "Blog", 1 ] - ], - "id" : "Roger Bell_West", - "name" : "Roger Bell_West" + ] }, { - "name" : "Simon Proctor", "id" : "Simon Proctor", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Simon Proctor" }, { + "id" : "Steven Wilson", + "name" : "Steven Wilson", "data" : [ [ "Perl", @@ -328,12 +527,10 @@ "Blog", 1 ] - ], - "id" : "Steven Wilson", - "name" : "Steven Wilson" + ] }, { - "id" : "Ulrich Rieke", + "name" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -344,20 +541,21 @@ 2 ] ], - "name" : "Ulrich Rieke" + "id" : "Ulrich Rieke" }, { + "id" : "Vinod Kumar K", "name" : "Vinod Kumar K", "data" : [ [ "Perl", 1 ] - ], - "id" : "Vinod Kumar K" + ] }, { "id" : "Walt Mankowski", + "name" : "Walt Mankowski", "data" : [ [ "Perl", @@ -367,203 +565,20 @@ "Blog", 1 ] - ], - "name" : "Walt Mankowski" + ] } ] }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "subtitle" : { - "text" : "[Champions: 31] Last updated at 2020-09-26 18:08:42 GMT" - }, - "chart" : { - "type" : "column" - }, - "legend" : { - "enabled" : 0 - }, "plotOptions" : { "series" : { + "borderWidth" : 0, "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 + "enabled" : 1, + "format" : "{point.y}" + } } }, - "xAxis" : { - "type" : "category" - }, - "tooltip" : { - "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", - "followPointer" : 1, - "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" - }, - "series" : [ - { - "colorByPoint" : 1, - "data" : [ - { - "drilldown" : "Abigail", - "name" : "Abigail", - "y" : 2 - }, - { - "drilldown" : "Andrew Shitov", - "name" : "Andrew Shitov", - "y" : 2 - }, - { - "y" : 4, - "drilldown" : "Athanasius", - "name" : "Athanasius" - }, - { - "y" : 2, - "name" : "Bob Lied", - "drilldown" : "Bob Lied" - }, - { - "drilldown" : "Colin Crain", - "name" : "Colin Crain", - "y" : 1 - }, - { - "name" : "Cristina Heredia", - "drilldown" : "Cristina Heredia", - "y" : 1 - }, - { - "y" : 4, - "name" : "Daniel Mantovani", - "drilldown" : "Daniel Mantovani" - }, - { - "y" : 2, - "drilldown" : "Dave Cross", - "name" : "Dave Cross" - }, - { - "y" : 2, - "drilldown" : "Dave Jacoby", - "name" : "Dave Jacoby" - }, - { - "name" : "E. Choroba", - "drilldown" : "E. Choroba", - "y" : 2 - }, - { - "name" : "Flavio Poletti", - "drilldown" : "Flavio Poletti", - "y" : 4 - }, - { - "name" : "James Smith", - "drilldown" : "James Smith", - "y" : 2 - }, - { - "y" : 2, - "drilldown" : "Jorg Sommrey", - "name" : "Jorg Sommrey" - }, - { - "y" : 4, - "name" : "Julio de Castro", - "drilldown" : "Julio de Castro" - }, - { - "y" : 2, - "drilldown" : "Kang-min Liu", - "name" : "Kang-min Liu" - }, - { - "y" : 5, - "drilldown" : "Laurent Rosenfeld", - "name" : "Laurent Rosenfeld" - }, - { - "y" : 1, - "name" : "Leo Manfredi", - "drilldown" : "Leo Manfredi" - }, - { - "y" : 2, - "drilldown" : "Lubos Kolouch", - "name" : "Lubos Kolouch" - }, - { - "y" : 2, - "drilldown" : "Mark Anderson", - "name" : "Mark Anderson" - }, - { - "drilldown" : "Markus Holzer", - "name" : "Markus Holzer", - "y" : 2 - }, - { - "y" : 4, - "drilldown" : "Mohammad S Anwar", - "name" : "Mohammad S Anwar" - }, - { - "y" : 5, - "name" : "Myoungjin Jeon", - "drilldown" : "Myoungjin Jeon" - }, - { - "y" : 2, - "drilldown" : "Niels van Dijke", - "name" : "Niels van Dijke" - }, - { - "name" : "Nuno Vieira", - "drilldown" : "Nuno Vieira", - "y" : 2 - }, - { - "y" : 1, - "drilldown" : "Rakulius", - "name" : "Rakulius" - }, - { - "name" : "Roger Bell_West", - "drilldown" : "Roger Bell_West", - "y" : 5 - }, - { - "y" : 2, - "name" : "Simon Proctor", - "drilldown" : "Simon Proctor" - }, - { - "y" : 3, - "name" : "Steven Wilson", - "drilldown" : "Steven Wilson" - }, - { - "drilldown" : "Ulrich Rieke", - "name" : "Ulrich Rieke", - "y" : 3 - }, - { - "name" : "Vinod Kumar K", - "drilldown" : "Vinod Kumar K", - "y" : 1 - }, - { - "name" : "Walt Mankowski", - "drilldown" : "Walt Mankowski", - "y" : 3 - } - ], - "name" : "Perl Weekly Challenge - 079" - } - ] + "subtitle" : { + "text" : "[Champions: 32] Last updated at 2020-09-26 18:12:55 GMT" + } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 920fa5e32e..2f0630b60e 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -2,6 +2,9 @@ "title" : { "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" }, + "subtitle" : { + "text" : "Last updated at 2020-09-26 18:12:55 GMT" + }, "series" : [ { "data" : [ @@ -11,53 +14,50 @@ ], [ "Perl", - 3363 + 3365 ], [ "Raku", 2182 ] ], - "name" : "Contributions", "dataLabels" : { - "enabled" : "true", - "color" : "#FFFFFF", - "y" : 10, - "rotation" : -90, - "format" : "{point.y:.0f}", "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" }, + "rotation" : -90, + "y" : 10, + "color" : "#FFFFFF", + "format" : "{point.y:.0f}", + "enabled" : "true", "align" : "right" - } + }, + "name" : "Contributions" } ], + "chart" : { + "type" : "column" + }, "legend" : { "enabled" : "false" }, + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 + }, "xAxis" : { + "type" : "category", "labels" : { "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" } - }, - "type" : "category" + } }, "tooltip" : { "pointFormat" : "<b>{point.y:.0f}</b>" - }, - "subtitle" : { - "text" : "Last updated at 2020-09-26 18:08:42 GMT" - }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } - }, - "chart" : { - "type" : "column" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 4c9041176f..3c1ea83b28 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,17 +1,39 @@ { + "title" : { + "text" : "Perl Weekly Challenge Language" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "legend" : { + "enabled" : "false" + }, + "tooltip" : { + "followPointer" : "true", + "headerFormat" : "<span style=\"font-size:11px\"></span>", + "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>" + }, + "xAxis" : { + "type" : "category" + }, + "chart" : { + "type" : "column" + }, "series" : [ { - "name" : "Perl Weekly Challenge Languages", + "colorByPoint" : "true", "data" : [ { "drilldown" : "001", - "name" : "#001", - "y" : 142 + "y" : 142, + "name" : "#001" }, { "y" : 111, - "drilldown" : "002", - "name" : "#002" + "name" : "#002", + "drilldown" : "002" }, { "y" : 71, @@ -19,169 +41,169 @@ "drilldown" : "003" }, { - "y" : 91, "drilldown" : "004", - "name" : "#004" + "name" : "#004", + "y" : 91 }, { - "y" : 72, "drilldown" : "005", + "y" : 72, "name" : "#005" }, { - "y" : 52, "drilldown" : "006", - "name" : "#006" + "name" : "#006", + "y" : 52 }, { - "y" : 59, + "drilldown" : "007", "name" : "#007", - "drilldown" : "007" + "y" : 59 }, { + "name" : "#008", "y" : 72, - "drilldown" : "008", - "name" : "#008" + "drilldown" : "008" }, { - "y" : 70, "drilldown" : "009", - "name" : "#009" + "name" : "#009", + "y" : 70 }, { + "drilldown" : "010", "y" : 60, - "name" : "#010", - "drilldown" : "010" + "name" : "#010" }, { - "name" : "#011", "drilldown" : "011", - "y" : 79 + "y" : 79, + "name" : "#011" }, { - "name" : "#012", "drilldown" : "012", + "name" : "#012", "y" : 83 }, { - "name" : "#013", "drilldown" : "013", + "name" : "#013", "y" : 78 }, { + "drilldown" : "014", "y" : 96, - "name" : "#014", - "drilldown" : "014" |
