diff options
| author | 冯昶 <fengchang@novel-supertv.com> | 2021-06-14 17:24:11 +0800 |
|---|---|---|
| committer | 冯昶 <fengchang@novel-supertv.com> | 2021-06-14 17:24:11 +0800 |
| commit | d683f9e0968c63bca70fbbfeeacf3e072d04c81b (patch) | |
| tree | a76486065455d294ee844de3b14b9c86edd6fd81 | |
| parent | 29562bef8edd547534f220916b3bdc0de1b7e7dd (diff) | |
| parent | 074a15e88412b0e5c857383ccfc1d0ac9bc027ee (diff) | |
| download | perlweeklychallenge-club-d683f9e0968c63bca70fbbfeeacf3e072d04c81b.tar.gz perlweeklychallenge-club-d683f9e0968c63bca70fbbfeeacf3e072d04c81b.tar.bz2 perlweeklychallenge-club-d683f9e0968c63bca70fbbfeeacf3e072d04c81b.zip | |
Merge remote-tracking branch 'upstream/master'
| -rw-r--r-- | challenge-116/pete-houston/c/ch-2.c | 37 | ||||
| -rw-r--r-- | challenge-116/pete-houston/lua/ch-2.lua | 34 | ||||
| -rw-r--r-- | challenge-116/pete-houston/perl/ch-1.pl | 37 | ||||
| -rw-r--r-- | challenge-116/pete-houston/perl/ch-2.pl | 24 | ||||
| -rw-r--r-- | stats/pwc-current.json | 255 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 58 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 1646 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 728 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 62 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 30 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 98 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 38 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 50 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 30 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 58 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 38 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 496 |
17 files changed, 1933 insertions, 1786 deletions
diff --git a/challenge-116/pete-houston/c/ch-2.c b/challenge-116/pete-houston/c/ch-2.c new file mode 100644 index 0000000000..20f3ecacdd --- /dev/null +++ b/challenge-116/pete-houston/c/ch-2.c @@ -0,0 +1,37 @@ +/*
+===============================================================================
+
+ FILE: 11602.c
+
+ USAGE: gcc 11602.c -lm && ./a.out N
+
+ DESCRIPTION: Is the sum of the squares of the digits a square? 1 for
+ yes, 0 for no.
+
+ AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk
+ ORGANIZATION: Openstrike
+ VERSION: 1.0
+ CREATED: 10/06/21
+===============================================================================
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+int main (int argc, char **argv) {
+ int ssd = 0;
+ int n = atoi(argv[1]);
+
+ /* Build the sum of the squares of the digits */
+ while (n) {
+ ssd += (n % 10) * (n % 10);
+ n /= 10;
+ }
+
+ /* Check it is a square or not */
+ n = sqrt (ssd);
+ n *= n;
+ printf ("%i\n", n == ssd);
+ return (0);
+}
diff --git a/challenge-116/pete-houston/lua/ch-2.lua b/challenge-116/pete-houston/lua/ch-2.lua new file mode 100644 index 0000000000..5ed527df8d --- /dev/null +++ b/challenge-116/pete-houston/lua/ch-2.lua @@ -0,0 +1,34 @@ +#!/usr/bin/env lua
+--[[
+#===============================================================================
+#
+# FILE: 11602.lua
+#
+# USAGE: ./11602.lua N
+#
+# DESCRIPTION: Is the sum of the squares of the digits a square? 1 for
+# yes, 0 for no.
+#
+# NOTES: N must be a decimal integer greater than 9
+# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk
+# ORGANIZATION: Openstrike
+# VERSION: 1.0
+# CREATED: 09/06/21
+#===============================================================================
+]]
+
+function rssd (n)
+ -- root sum square digits
+ local t = 0
+ for c in string.gmatch (n, "%d") do
+ t = t+c*c
+ end
+ return math.sqrt (t)
+end
+
+root = rssd (arg[1])
+if (root == math.tointeger (root)) then
+ print (1)
+else
+ print (0)
+end
diff --git a/challenge-116/pete-houston/perl/ch-1.pl b/challenge-116/pete-houston/perl/ch-1.pl new file mode 100644 index 0000000000..e30b6b06c8 --- /dev/null +++ b/challenge-116/pete-houston/perl/ch-1.pl @@ -0,0 +1,37 @@ +#!/usr/bin/env perl +#=============================================================================== +# +# FILE: 11601.pl +# +# USAGE: ./11601.pl N +# +# DESCRIPTION: Can this number be split into a sequence of ascending +# continguous smaller numbers? +# +# NOTES: N must be a decimal integer of 2 digits or more +# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk +# ORGANIZATION: Openstrike +# VERSION: 1.0 +# CREATED: 07/06/21 +#=============================================================================== + +use strict; +use warnings; + +my $n = shift; + +my $halflen = length ($n) / 2; + +for my $power (1 .. $halflen) { + my $parts = my $target = my $x = substr ($n, 0, $power); + do { + $target .= ++$x; + $parts .= ',' . $x; + } until $target >= $n; + if ($target == $n) { + print "$parts\n"; + exit; + } +} + +print "$n\n"; diff --git a/challenge-116/pete-houston/perl/ch-2.pl b/challenge-116/pete-houston/perl/ch-2.pl new file mode 100644 index 0000000000..b58563e233 --- /dev/null +++ b/challenge-116/pete-houston/perl/ch-2.pl @@ -0,0 +1,24 @@ +#!/usr/bin/env perl +#=============================================================================== +# +# FILE: 11602.pl +# +# USAGE: ./11602.pl N +# +# DESCRIPTION: Is the sum of the squares of the digits a square? 1 for +# yes, 0 for no. +# +# REQUIREMENTS: List::Util (core) +# NOTES: N must be a decimal integer greater than 9 +# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk +# ORGANIZATION: Openstrike +# VERSION: 1.0 +# CREATED: 07/06/21 +#=============================================================================== + +use strict; +use warnings; +use List::Util 'sum'; + +my $root = sqrt sum map { $_ * $_ } split //, shift; +print $root == int $root ? "1\n" : "0\n"; diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 4325f185e5..6d47ed0a85 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,12 +1,4 @@ { - "tooltip" : { - "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", - "followPointer" : 1, - "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>" - }, - "legend" : { - "enabled" : 0 - }, "plotOptions" : { "series" : { "borderWidth" : 0, @@ -16,10 +8,28 @@ } } }, + "legend" : { + "enabled" : 0 + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "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/>" + }, + "subtitle" : { + "text" : "[Champions: 30] Last updated at 2021-06-14 08:09:04 GMT" + }, + "title" : { + "text" : "Perl Weekly Challenge - 116" + }, "drilldown" : { "series" : [ { - "id" : "Aaron Smith", "data" : [ [ "Raku", @@ -30,11 +40,12 @@ 1 ] ], - "name" : "Aaron Smith" + "name" : "Aaron Smith", + "id" : "Aaron Smith" }, { - "id" : "Abigail", "name" : "Abigail", + "id" : "Abigail", "data" : [ [ "Perl", @@ -48,6 +59,7 @@ }, { "id" : "Adam Russell", + "name" : "Adam Russell", "data" : [ [ "Perl", @@ -57,12 +69,9 @@ "Blog", 1 ] - ], - "name" : "Adam Russell" + ] }, { - "id" : "Arne Sommer", - "name" : "Arne Sommer", "data" : [ [ "Perl", @@ -76,7 +85,9 @@ "Blog", 1 ] - ] + ], + "id" : "Arne Sommer", + "name" : "Arne Sommer" }, { "data" : [ @@ -93,28 +104,26 @@ "id" : "Athanasius" }, { - "id" : "Bob Lied", - "name" : "Bob Lied", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Bob Lied", + "id" : "Bob Lied" }, { "name" : "Cheok-Yin Fung", + "id" : "Cheok-Yin Fung", "data" : [ [ "Perl", 2 ] - ], - "id" : "Cheok-Yin Fung" + ] }, { - "id" : "Colin Crain", - "name" : "Colin Crain", "data" : [ [ "Perl", @@ -128,11 +137,13 @@ "Blog", 1 ] - ] + ], + "id" : "Colin Crain", + "name" : "Colin Crain" }, { - "id" : "Cristina Heredia", "name" : "Cristina Heredia", + "id" : "Cristina Heredia", "data" : [ [ "Perl", @@ -141,8 +152,6 @@ ] }, { - "id" : "Dave Jacoby", - "name" : "Dave Jacoby", "data" : [ [ "Perl", @@ -152,7 +161,9 @@ "Blog", 1 ] - ] + ], + "name" : "Dave Jacoby", + "id" : "Dave Jacoby" }, { "data" : [ @@ -165,17 +176,16 @@ "id" : "Duncan C. White" }, { - "id" : "E. Choroba", - "name" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "E. Choroba", + "name" : "E. Choroba" }, { - "name" : "Flavio Poletti", "data" : [ [ "Perl", @@ -190,6 +200,7 @@ 2 ] ], + "name" : "Flavio Poletti", "id" : "Flavio Poletti" }, { @@ -211,8 +222,8 @@ ] }, { - "id" : "James Smith", "name" : "James Smith", + "id" : "James Smith", "data" : [ [ "Perl", @@ -231,21 +242,22 @@ 2 ] ], - "name" : "Jan Krnavek", - "id" : "Jan Krnavek" + "id" : "Jan Krnavek", + "name" : "Jan Krnavek" }, { - "id" : "Jorg Sommrey", - "name" : "Jorg Sommrey", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Jorg Sommrey", + "id" : "Jorg Sommrey" }, { "name" : "Laurent Rosenfeld", + "id" : "Laurent Rosenfeld", "data" : [ [ "Perl", @@ -259,10 +271,10 @@ "Blog", 1 ] - ], - "id" : "Laurent Rosenfeld" + ] }, { + "id" : "Luca Ferrari", "name" : "Luca Ferrari", "data" : [ [ @@ -273,42 +285,51 @@ "Blog", 2 ] - ], - "id" : "Luca Ferrari" + ] }, { + "name" : "Mark Anderson", "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] - ], - "name" : "Mark Anderson" + ] }, { - "id" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] ], + "id" : "Niels van Dijke", "name" : "Niels van Dijke" }, { + "id" : "Paulo Custodio", + "name" : "Paulo Custodio", "data" : [ [ "Perl", 2 ] - ], - "name" : "Paulo Custodio", - "id" : "Paulo Custodio" + ] + }, + { + "name" : "Pete Houston", + "id" : "Pete Houston", + "data" : [ + [ + "Perl", + 2 + ] + ] }, { - "id" : "Roger Bell_West", "name" : "Roger Bell_West", + "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -325,6 +346,7 @@ ] }, { + "id" : "Simon Green", "name" : "Simon Green", "data" : [ [ @@ -335,22 +357,19 @@ "Blog", 1 ] - ], - "id" : "Simon Green" + ] }, { - "name" : "Simon Proctor", "data" : [ [ "Raku", 2 ] ], - "id" : "Simon Proctor" + "id" : "Simon Proctor", + "name" : "Simon Proctor" }, { - "id" : "Stuart Little", - "name" : "Stuart Little", "data" : [ [ "Perl", @@ -360,9 +379,12 @@ "Raku", 2 ] - ] + ], + "id" : "Stuart Little", + "name" : "Stuart Little" }, { + "name" : "Ulrich Rieke", "id" : "Ulrich Rieke", "data" : [ [ @@ -373,12 +395,9 @@ "Raku", 1 ] - ], - "name" : "Ulrich Rieke" + ] }, { - "id" : "W. Luis Mochan", - "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -388,99 +407,99 @@ "Blog", 1 ] - ] + ], + "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan" }, { "id" : "Wanderdoc", + "name" : "Wanderdoc", "data" : [ [ "Perl", 2 ] - ], - "name" : "Wanderdoc" + ] } ] }, - "title" : { - "text" : "Perl Weekly Challenge - 116" - }, - "subtitle" : { - "text" : "[Champions: 29] Last updated at 2021-06-14 06:45:38 GMT" + "xAxis" : { + "type" : "category" }, "series" : [ { "name" : "Perl Weekly Challenge - 116", + "colorByPoint" : 1, "data" : [ { "drilldown" : "Aaron Smith", - "name" : "Aaron Smith", - "y" : 3 + "y" : 3, + "name" : "Aaron Smith" }, { - "drilldown" : "Abigail", "name" : "Abigail", - "y" : 4 + "y" : 4, + "drilldown" : "Abigail" }, { + "drilldown" : "Adam Russell", "name" : "Adam Russell", - "y" : 3, - "drilldown" : "Adam Russell" + "y" : 3 }, { "drilldown" : "Arne Sommer", - "y" : 5, - "name" : "Arne Sommer" + "name" : "Arne Sommer", + "y" : 5 }, { - "name" : "Athanasius", "y" : 4, + "name" : "Athanasius", "drilldown" : "Athanasius" }, { - "drilldown" : "Bob Lied", + "y" : 2, "name" : "Bob Lied", - "y" : 2 + "drilldown" : "Bob Lied" }, { "drilldown" : "Cheok-Yin Fung", - "y" : 2, - "name" : "Cheok-Yin Fung" + "name" : "Cheok-Yin Fung", + "y" : 2 }, { - "name" : "Colin Crain", + "drilldown" : "Colin Crain", "y" : 5, - "drilldown" : "Colin Crain" + "name" : "Colin Crain" }, { - "y" : 1, "name" : "Cristina Heredia", + "y" : 1, "drilldown" : "Cristina Heredia" }, { - "drilldown" : "Dave Jacoby", + "y" : 3, "name" : "Dave Jacoby", - "y" : 3 + "drilldown" : "Dave Jacoby" }, { - "drilldown" : "Duncan C. White", + "name" : "Duncan C. White", "y" : 2, - "name" : "Duncan C. White" + "drilldown" : "Duncan C. White" }, { - "drilldown" : "E. Choroba", "name" : "E. Choroba", - "y" : 2 + "y" : 2, + "drilldown" : "E. Choroba" }, { - "name" : "Flavio Poletti", "y" : 6, + "name" : "Flavio Poletti", "drilldown" : "Flavio Poletti" }, { - "drilldown" : "Jaldhar H. Vyas", "name" : "Jaldhar H. Vyas", - "y" : 5 + "y" : 5, + "drilldown" : "Jaldhar H. Vyas" }, { "name" : "James Smith", @@ -488,9 +507,9 @@ "drilldown" : "James Smith" }, { - "drilldown" : "Jan Krnavek", "name" : "Jan Krnavek", - "y" : 2 + "y" : 2, + "drilldown" : "Jan Krnavek" }, { "drilldown" : "Jorg Sommrey", @@ -503,9 +522,9 @@ "name" : "Laurent Rosenfeld" }, { - "drilldown" : "Luca Ferrari", + "y" : 4, "name" : "Luca Ferrari", - "y" : 4 + "drilldown" : "Luca Ferrari" }, { "drilldown" : "Mark Anderson", @@ -513,29 +532,34 @@ "name" : "Mark Anderson" }, { + "drilldown" : "Niels van Dijke", "y" : 2, - "name" : "Niels van Dijke", - "drilldown" : "Niels van Dijke" + "name" : "Niels van Dijke" }, { - "drilldown" : "Paulo Custodio", "name" : "Paulo Custodio", - "y" : 2 + "y" : 2, + "drilldown" : "Paulo Custodio" + }, + { + "name" : "Pete Houston", + "y" : 2, + "drilldown" : "Pete Houston" }, { - "name" : "Roger Bell_West", "y" : 5, + "name" : "Roger Bell_West", "drilldown" : "Roger Bell_West" }, { - "y" : 3, + "drilldown" : "Simon Green", "name" : "Simon Green", - "drilldown" : "Simon Green" + "y" : 3 }, { - "drilldown" : "Simon Proctor", "name" : "Simon Proctor", - "y" : 2 + "y" : 2, + "drilldown" : "Simon Proctor" }, { "y" : 4, @@ -548,28 +572,19 @@ "drilldown" : "Ulrich Rieke" }, { - "drilldown" : "W. Luis Mochan", + "name" : "W. Luis Mochan", "y" : 3, - "name" : "W. Luis Mochan" + "drilldown" : "W. Luis Mochan" }, { + "drilldown" : "Wanderdoc", "y" : 2, - "name" : "Wanderdoc", - "drilldown" : "Wanderdoc" + "name" : "Wanderdoc" } - ], - "colorByPoint" : 1 + ] } ], - "xAxis" : { - "type" : "category" - }, "chart" : { "type" : "column" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index a085b8494f..b020c38577 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,41 +1,24 @@ { - "chart" : { - "type" : "column" - }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } - }, - "xAxis" : { - "type" : "category", - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - } - }, "title" : { "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" }, - "subtitle" : { - "text" : "Last updated at 2021-06-14 06:45:38 GMT" + "chart" : { + "type" : "column" }, "series" : [ { + "name" : "Contributions", "dataLabels" : { + "format" : "{point.y:.0f}", + "rotation" : -90, + "enabled" : "true", + "align" : "right", + "color" : "#FFFFFF", "y" : 10, "style" : { "fontFamily" : "Verdana, sans-serif", "fontSize" : "13px" - }, - "rotation" : -90, - "format" : "{point.y:.0f}", - "color" : "#FFFFFF", - "enabled" : "true", - "align" : "right" + } }, "data" : [ [ @@ -44,19 +27,36 @@ ], [ "Perl", - 5508 + 5510 ], [ "Raku", 3489 ] - ], - "name" : "Contributions" + ] } ], + "xAxis" : { + "labels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } + }, + "type" : "category" + }, "tooltip" : { "pointFormat" : "<b>{point.y:.0f}</b>" }, + "subtitle" : { + "text" : "Last updated at 2021-06-14 08:09:04 GMT" + }, + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } + }, "legend" : { "enabled" : "false" } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index cfcdfea8cd..801a79b76d 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,19 +1,609 @@ { + "subtitle" : { + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2021-06-14 08:09:04 GMT" + }, + "tooltip" : { + "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>", + "headerFormat" : "<span style=\"font-size:11px\"></span>", + "followPointer" : "true" + }, "chart" : { "type" : "column" }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" + "series" : [ + { + "name" : "Perl Weekly Challenge Languages", + "data" : [ + { + "drilldown" : "001", + "name" : "#001", + "y" : 161 + }, + { + "name" : "#002", + "y" : 125, + "drilldown" : "002" + }, + { + "drilldown" : "003", + "name" : "#003", + "y" : 81 + }, + { + "y" : 99, + "name" : "#004", + "drilldown" : "004" + }, + { + "drilldown" : "005", + "name" : "#005", + "y" : 78 + }, + { + "name" : "#006", + "y" : 58, + "drilldown" : "006" + }, + { + "drilldown" : "007", + "y" : 64, + "name" : "#007" + }, + { + "drilldown" : "008", + "y" : 78, + "name" : "#008" + }, + { + "drilldown" : "009", + "y" : 76, + "name" : "#009" + }, + { + "drilldown" : "010", + "y" : 65, + "name" : "#010" + }, + { + "y" : 85, + "name" : "#011", + "drilldown" : "011" + }, + { + "drilldown" : "012", + "y" : 89, + "name" : "#012" + }, + { + "drilldown" : "013", + "y" : 85, + "name" : "#013" + }, + { + "name" : "#014", + "y" : 101, + "drilldown" : "014" + }, + { + "drilldown" : "015", + "name" : "#015", + "y" : 99 + }, + { + "name" : "#016", + "y" : 71, + "drilldown" : "016" + }, + { + "y" : 84, + "name" : "#017", + "drilldown" : "017" + }, + { + "name" : "#018", + "y" : 81, + "drilldown" : "018" + }, + { + "y" : 103, + "name" : "#019", + "drilldown" : "019" + }, + { + "drilldown" : "020", + "name" : "#020", + "y" : 101 + }, + { + "drilldown" : "021", + "name" : "#021", + "y" : 72 + }, + { + "drilldown" : "022", + "name" : "#022", + "y" : 68 + }, + { + "y" : 97, + "name" : "#023", + "drilldown" : "023" + }, + { + "drilldown" : "024", + "y" : 74, + "name" : "#024" + }, + { + "name" : "#025", + "y" : 59, + "drilldown" : "025" + }, + { + "name" : "#026", + "y" : 74, + "drilldown" : "026" + }, + { + "drilldown" : "027", + "name" : "#027", + "y" : 60 + }, + { + "name" : "#028", + "y" : 80, + "drilldown" : "028" + }, + { + "drilldown" : "029", + "name" : "#029", + "y" : 79 + }, + { + "name" : "#030", + "y" : 117, + "drilldown" : "030" + }, + { + "drilldown" : "031", + "name" : "#031", + "y" : 89 + }, + { + "y" : 94, + "name" : "#032", + "drilldown" : "032" + }, + { + "y" : 110, + "name" : "#033", + "drilldown" : "033" + }, + { + "y" : 64, + "name" : "#034", + "drilldown" : "034" |
