diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-12-06 13:56:30 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-12-06 13:56:30 +0000 |
| commit | 33f2b9c7ca303cec3920728831ba663e2982c204 (patch) | |
| tree | 2f371b4e06c3cad40ce73d56b586b03c74ed2c63 | |
| parent | b8139671cf7b05d0d3f7389de80419b90c28a6dc (diff) | |
| download | perlweeklychallenge-club-33f2b9c7ca303cec3920728831ba663e2982c204.tar.gz perlweeklychallenge-club-33f2b9c7ca303cec3920728831ba663e2982c204.tar.bz2 perlweeklychallenge-club-33f2b9c7ca303cec3920728831ba663e2982c204.zip | |
- Added solutions by Alexander Karelas.
| -rwxr-xr-x | challenge-089/alexander-karelas/perl/ch-1.pl | 30 | ||||
| -rwxr-xr-x | challenge-089/alexander-karelas/perl/ch-2.pl | 60 | ||||
| -rw-r--r-- | stats/pwc-current.json | 435 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 70 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 620 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 366 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 98 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 54 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 102 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 102 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 104 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 108 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 48 |
14 files changed, 1207 insertions, 1102 deletions
diff --git a/challenge-089/alexander-karelas/perl/ch-1.pl b/challenge-089/alexander-karelas/perl/ch-1.pl new file mode 100755 index 0000000000..1be2d6fbbd --- /dev/null +++ b/challenge-089/alexander-karelas/perl/ch-1.pl @@ -0,0 +1,30 @@ +#!/usr/bin/env perl + +use v5.30; +use warnings; + +my $N = $ARGV[0] or die "Usage: $0 \$N"; + +my $sum = 0; +for (my $x = 1; $x <= $N - 1; $x++) { + for (my $y = $x + 1; $y <= $N; $y++) { + $sum += gcd($x, $y); + } +} + +say $sum; + +sub gcd { + my ($x, $y) = @_; + + if ($x < $y) { + ($x, $y) = ($y, $x); + } + + if ($y == 0) { + return $x; + } + + return gcd($y, $x % $y); +} + diff --git a/challenge-089/alexander-karelas/perl/ch-2.pl b/challenge-089/alexander-karelas/perl/ch-2.pl new file mode 100755 index 0000000000..3d306ca17b --- /dev/null +++ b/challenge-089/alexander-karelas/perl/ch-2.pl @@ -0,0 +1,60 @@ +#!/usr/bin/env perl + +use v5.30; +use warnings; + +# 0 1 2 +# 3 4 5 +# 6 7 8 + +# x y +# z w + +my @winning_rows = ( + [0, 1, 2], + [3, 4, 5], + [6, 7, 8], + [0, 3, 6], + [1, 4, 7], + [2, 5, 8], + [0, 4, 8], + [2, 4, 6], +); + +my %available_numbers; + +sub reset_available { + %available_numbers = map {($_, 1)} (1 .. 9); +} + +for my $x (1 .. 9) { + for my $y (1 .. 9) { + next if $y == $x; + for my $z (1 .. 9) { + next if $z == $y or $z == $x; + for my $w (1 .. 9) { + next if $w == $z or $w == $y or $w == $x; + reset_available(); + delete @available_numbers{($x, $y, $z, $w)}; + my $num_0_2 = 15 - $x - $y; + next unless delete $available_numbers{$num_0_2}; + my $num_1_2 = 15 - $z - $w; + next unless delete $available_numbers{$num_1_2}; + my $num_2_0 = 15 - $x - $z; + next unless delete $available_numbers{$num_2_0}; + my $num_2_1 = 15 - $y - $w; + next unless delete $available_numbers{$num_2_1}; + my $num_2_2 = 15 - $num_2_0 - $num_2_1; + next unless delete $available_numbers{$num_2_2}; + + next unless $x + $w + $num_2_2 == 15; + next unless $num_0_2 + $w + $num_2_0 == 15; + + print "[ $x $y $num_0_2 ]\n"; + print "[ $z $w $num_1_2 ]\n"; + print "[ $num_2_0 $num_2_1 $num_2_2 ]\n"; + print "=================\n"; + } + } + } +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 706fa8062d..9c336389d7 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,174 +1,8 @@ { - "xAxis" : { - "type" : "category" - }, - "subtitle" : { - "text" : "[Champions: 26] Last updated at 2020-12-06 13:49:27 GMT" - }, - "title" : { - "text" : "Perl Weekly Challenge - 089" - }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - } - } - }, - "chart" : { - "type" : "column" - }, - "series" : [ - { - "data" : [ - { - "y" : 3, - "drilldown" : "Aaron Smith", - "name" : "Aaron Smith" - }, - { - "name" : "Abigail", - "y" : 2, - "drilldown" : "Abigail" - }, - { - "y" : 2, - "drilldown" : "Alexander Pankoff", - "name" : "Alexander Pankoff" - }, - { - "name" : "Andrew Shitov", - "drilldown" : "Andrew Shitov", - "y" : 2 - }, - { - "y" : 5, - "drilldown" : "Arne Sommer", - "name" : "Arne Sommer" - }, - { - "name" : "Athanasius", - "y" : 4, - "drilldown" : "Athanasius" - }, - { - "y" : 2, - "drilldown" : "Clifton Wood", - "name" : "Clifton Wood" - }, - { - "y" : 3, - "drilldown" : "Dave Jacoby", - "name" : "Dave Jacoby" - }, - { - "drilldown" : "Feng Chang", - "y" : 2, - "name" : "Feng Chang" - }, - { - "name" : "James Smith", - "y" : 2, - "drilldown" : "James Smith" - }, - { - "y" : 2, - "drilldown" : "Jan Krnavek", - "name" : "Jan Krnavek" - }, - { - "name" : "Joel Crosswhite", - "drilldown" : "Joel Crosswhite", - "y" : 2 - }, - { - "drilldown" : "Jorg Sommrey", - "y" : 2, - "name" : "Jorg Sommrey" - }, - { - "drilldown" : "Kang-min Liu", - "y" : 4, - "name" : "Kang-min Liu" - }, - { - "name" : "Lubos Kolouch", - "drilldown" : "Lubos Kolouch", - "y" : 2 - }, - { - "name" : "Mark Anderson", - "y" : 2, - "drilldown" : "Mark Anderson" - }, - { - "name" : "Miguel Prz", - "drilldown" : "Miguel Prz", - "y" : 2 - }, - { - "y" : 2, - "drilldown" : "Nuno Vieira", - "name" : "Nuno Vieira" - }, - { - "drilldown" : "Philip Hood", - "y" : 2, - "name" : "Philip Hood" - }, - { - "name" : "Roger Bell_West", - "drilldown" : "Roger Bell_West", - "y" : 5 - }, - { - "y" : 3, - "drilldown" : "Simon Green", - "name" : "Simon Green" - }, - { - "name" : "Simon Proctor", - "drilldown" : "Simon Proctor", - "y" : 2 - }, - { - "y" : 2, - "drilldown" : "Stuart Little", - "name" : "Stuart Little" - }, - { - "name" : "Ulrich Rieke", - "y" : 4, - "drilldown" : "Ulrich Rieke" - }, - { - "y" : 3, - "drilldown" : "W. Luis Mochan", - "name" : "W. Luis Mochan" - }, - { - "name" : "Walt Mankowski", - "drilldown" : "Walt Mankowski", - "y" : 3 - } - ], - "name" : "Perl Weekly Challenge - 089", - "colorByPoint" : 1 - } - ], - "legend" : { - "enabled" : 0 - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, "drilldown" : { "series" : [ { + "name" : "Aaron Smith", "data" : [ [ "Raku", @@ -179,31 +13,41 @@ 1 ] ], - "name" : "Aaron Smith", "id" : "Aaron Smith" }, { "id" : "Abigail", - "name" : "Abigail", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Abigail" + }, + { + "id" : "Alexander Karelas", + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Alexander Karelas" }, { - "id" : "Alexander Pankoff", "name" : "Alexander Pankoff", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Alexander Pankoff" }, { "name" : "Andrew Shitov", + "id" : "Andrew Shitov", "data" : [ [ "Perl", @@ -213,11 +57,10 @@ "Raku", 1 ] - ], - "id" : "Andrew Shitov" + ] }, { - "name" : "Arne Sommer", + "id" : "Arne Sommer", "data" : [ [ "Perl", @@ -232,10 +75,10 @@ 1 ] ], - "id" : "Arne Sommer" + "name" : "Arne Sommer" }, { - "id" : "Athanasius", + "name" : "Athanasius", "data" : [ [ "Perl", @@ -246,7 +89,7 @@ 2 ] ], - "name" : "Athanasius" + "id" : "Athanasius" }, { "id" : "Clifton Wood", @@ -259,7 +102,6 @@ "name" : "Clifton Wood" }, { - "name" : "Dave Jacoby", "data" : [ [ "Perl", @@ -270,7 +112,8 @@ 1 ] ], - "id" : "Dave Jacoby" + "id" : "Dave Jacoby", + "name" : "Dave Jacoby" }, { "name" : "Feng Chang", @@ -283,14 +126,14 @@ "id" : "Feng Chang" }, { - "id" : "James Smith", "name" : "James Smith", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "James Smith" }, { "id" : "Jan Krnavek", @@ -304,23 +147,23 @@ }, { "name" : "Joel Crosswhite", + "id" : "Joel Crosswhite", "data" : [ [ "Perl", 2 ] - ], - "id" : "Joel Crosswhite" + ] }, { - "id" : "Jorg Sommrey", + "name" : "Jorg Sommrey", "data" : [ [ "Perl", 2 ] ], - "name" : "Jorg Sommrey" + "id" : "Jorg Sommrey" }, { "data" : [ @@ -333,28 +176,28 @@ 2 ] ], - "name" : "Kang-min Liu", - "id" : "Kang-min Liu" + "id" : "Kang-min Liu", + "name" : "Kang-min Liu" }, { + "name" : "Lubos Kolouch", "id" : "Lubos Kolouch", "data" : [ [ "Perl", 2 ] - ], - "name" : "Lubos Kolouch" + ] }, { - "name" : "Mark Anderson", + "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "id" : "Mark Anderson" + "name" : "Mark Anderson" }, { "name" : "Miguel Prz", @@ -373,21 +216,20 @@ 2 ] ], - "name" : "Nuno Vieira", - "id" : "Nuno Vieira" + "id" : "Nuno Vieira", + "name" : "Nuno Vieira" }, { - "name" : "Philip Hood", + "id" : "Philip Hood", "data" : [ [ "Raku", 2 ] ], - "id" : "Philip Hood" + "name" : "Philip Hood" }, { - "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -402,6 +244,7 @@ 1 ] ], + "id" : "Roger Bell_West", "name" : "Roger Bell_West" }, { @@ -419,24 +262,24 @@ "id" : "Simon Green" }, { - "id" : "Simon Proctor", "name" : "Simon Proctor", "data" : [ [ "Raku", 2 ] - ] + ], + "id" : "Simon Proctor" }, { + "name" : "Stuart Little", "id" : "Stuart Little", "data" : [ [ "Raku", 2 ] - ], - "name" : "Stuart Little" + ] }, { "data" : [ @@ -449,12 +292,10 @@ 2 ] ], - "name" : "Ulrich Rieke", - "id" : "Ulrich Rieke" + "id" : "Ulrich Rieke", + "name" : "Ulrich Rieke" }, { - "id" : "W. Luis Mochan", - "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -464,10 +305,13 @@ "Blog", 1 ] - ] + ], + "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan" }, { "name" : "Walt Mankowski", + "id" : "Walt Mankowski", "data" : [ [ "Perl", @@ -477,14 +321,185 @@ "Blog", 1 ] - ], - "id" : "Walt Mankowski" + ] } ] }, + "title" : { + "text" : "Perl Weekly Challenge - 089" + }, + "legend" : { + "enabled" : 0 + }, + "series" : [ + { + "data" : [ + { + "y" : 3, + "name" : "Aaron Smith", + "drilldown" : "Aaron Smith" + }, + { + "y" : 2, + "name" : "Abigail", + "drilldown" : "Abigail" + }, + { + "drilldown" : "Alexander Karelas", + "name" : "Alexander Karelas", + "y" : 2 + }, + { + "drilldown" : "Alexander Pankoff", + "name" : "Alexander Pankoff", + "y" : 2 + }, + { + "name" : "Andrew Shitov", + "drilldown" : "Andrew Shitov", + "y" : 2 + }, + { + "drilldown" : "Arne Sommer", + "name" : "Arne Sommer", + "y" : 5 + }, + { + "y" : 4, + "drilldown" : "Athanasius", + "name" : "Athanasius" + }, + { + "y" : 2, + "name" : "Clifton Wood", + "drilldown" : "Clifton Wood" + }, + { + "drilldown" : "Dave Jacoby", + "name" : "Dave Jacoby", + "y" : 3 + }, + { + "y" : 2, + "name" : "Feng Chang", + "drilldown" : "Feng Chang" + }, + { + "name" : "James Smith", + "drilldown" : "James Smith", + "y" : 2 + }, + { + "drilldown" : "Jan Krnavek", + "name" : "Jan Krnavek", + "y" : 2 + }, + { + "name" : "Joel Crosswhite", + "drilldown" : "Joel Crosswhite", + "y" : 2 + }, + { + "drilldown" : "Jorg Sommrey", + "name" : "Jorg Sommrey", + "y" : 2 + }, + { + "y" : 4, + "name" : "Kang-min Liu", + "drilldown" : "Kang-min Liu" + }, + { + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch", + "y" : 2 + }, + { + "y" : 2, + "name" : "Mark Anderson", + "drilldown" : "Mark Anderson" + }, + { + "y" : 2, + "drilldown" : "Miguel Prz", + "name" : "Miguel Prz" + }, + { + "name" : "Nuno Vieira", + "drilldown" : "Nuno Vieira", + "y" : 2 + }, + { + "y" : 2, + "drilldown" : "Philip Hood", + "name" : "Philip Hood" + }, + { + "y" : 5, + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West" + }, + { + "name" : "Simon Green", + "drilldown" : "Simon Green", + "y" : 3 + }, + { + "y" : 2, + "name" : "Simon Proctor", + "drilldown" : "Simon Proctor" + }, + { + "name" : "Stuart Little", + "drilldown" : "Stuart Little", + "y" : 2 + }, + { + "y" : 4, + "name" : "Ulrich Rieke", + "drilldown" : "Ulrich Rieke" + }, + { + "drilldown" : "W. Luis Mochan", + "name" : "W. Luis Mochan", + "y" : 3 + }, + { + "name" : "Walt Mankowski", + "drilldown" : "Walt Mankowski", + "y" : 3 + } + ], + "colorByPoint" : 1, + "name" : "Perl Weekly Challenge - 089" + } + ], "tooltip" : { - "followPointer" : 1, + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", "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 + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "subtitle" : { + "text" : "[Champions: 27] Last updated at 2020-12-06 13:56:08 GMT" + }, + "chart" : { + "type" : "column" + }, + "xAxis" : { + "type" : "category" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index f444712cc2..19edef85a2 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,34 +1,6 @@ { - "subtitle" : { - "text" : "Last updated at 2020-12-06 13:49:26 GMT" - }, - "title" : { - "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" - }, - "xAxis" : { - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - }, - "type" : "category" - }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } - }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, - "legend" : { - "enabled" : "false" - }, "series" : [ { - "name" : "Contributions", "data" : [ [ "Blog", @@ -36,7 +8,7 @@ ], [ "Perl", - 3995 + 3997 ], [ "Raku", @@ -44,20 +16,48 @@ ] ], "dataLabels" : { - "enabled" : "true", - "y" : 10, - "align" : "right", "color" : "#FFFFFF", - "format" : "{point.y:.0f}", + "rotation" : -90, + "y" : 10, "style" : { "fontFamily" : "Verdana, sans-serif", "fontSize" : "13px" }, - "rotation" : -90 - } + "enabled" : "true", + "align" : "right", + "format" : "{point.y:.0f}" + }, + "name" : "Contributions" } ], + "legend" : { + "enabled" : "false" + }, + "title" : { + "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" + }, + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 + }, + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } + } + }, "chart" : { "type" : "column" + }, + "subtitle" : { + "text" : "Last updated at 2020-12-06 13:56:08 GMT" + }, + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 5f923a01e3..4f173def8b 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,13 +1,7 @@ { - "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-12-06 13:49:27 GMT" - }, "title" : { "text" : "Perl Weekly Challenge Language" }, - "xAxis" : { - "type" : "category" - }, "drilldown" : { "series" : [ { @@ -43,8 +37,8 @@ 10 ] ], - "name" : "002", - "id" : "002" + "id" : "002", + "name" : "002" }, { "name" : "003", @@ -65,8 +59,6 @@ "id" : "003" }, { - "id" : "004", - "name" : "004", "data" : [ [ "Perl", @@ -80,7 +72,9 @@ "Blog", 10 ] - ] + ], + "id" : "004", + "name" : "004" }, { "name" : "005", @@ -101,8 +95,6 @@ "id" : "005" }, { - "id" : "006", - "name" : "006", "data" : [ [ "Perl", @@ -116,10 +108,11 @@ "Blog", 7 ] - ] + ], + "id" : "006", + "name" : "006" }, { - "id" : "007", "data" : [ [ "Perl", @@ -134,10 +127,11 @@ 10 ] ], + "id" : "007", "name" : "007" }, { - "id" : "008", + "name" : "008", "data" : [ [ "Perl", @@ -152,7 +146,7 @@ 12 ] ], - "name" : "008" + "id" : "008" }, { "id" : "009", @@ -173,7 +167,6 @@ "name" : "009" }, { - "name" : "010", "data" : [ [ "Perl", @@ -188,7 +181,8 @@ 11 ] ], - "id" : "010" + "id" : "010", + "name" : "010" }, { "name" : "011", @@ -259,10 +253,11 @@ 15 ] ], - "name" : "014", - "id" : "014" + "id" : "014", + "name" : "014" }, { + "id" : "015", "data" : [ [ "Perl", @@ -277,8 +272,7 @@ 15 ] ], - "name" : "015", - "id" : "015" + "name" : "015" }, { "id" : "016", @@ -317,8 +311,6 @@ "id" : "017" }, { - "id" : "018", - "name" : "018", "data" : [ [ "Perl", @@ -332,9 +324,13 @@ "Blog", 14 ] - ] + ], + "id" : "018", + "name" : "018" }, { + "name" : "019", + "id" : "019", "data" : [ [ "Perl", @@ -348,12 +344,10 @@ "Blog", 13 ] - ], - "name" : "019", - "id" : "019" + ] }, { - "id" : "020", + "name" : "020", "data" : [ [ "Perl", @@ -368,9 +362,11 @@ 13 ] ], - "name" : "020" + "id" : "020" }, { + "name" : "021", + "id" : "021", "data" : [ [ "Perl", @@ -384,11 +380,11 @@ "Blog", 10 ] - ], - "name" : "021", - "id" : "021" + ] }, { + "name" : "022", + "id" : "022", "data" : [ [ "Perl", @@ -402,12 +398,9 @@ "Blog", 10 ] - ], - "name" : "022", - "id" : "022" + ] }, { - "name" : "023", "data" : [ [ "Perl", @@ -422,9 +415,11 @@ 12 ] ], - "id" : "023" + "id" : "023", + "name" : "023" }, { + "name" : "024", "data" : [ [ "Perl", @@ -439,11 +434,9 @@ 11 ] ], - "name" : "024", "id" : "024" }, { - "id" : "025", "name" : "025", "data" : [ [ @@ -458,11 +451,12 @@ "Blog", 12 ] - ] + ], + "id" : "025" }, { - "id" : "026", "name" : "026", + "id" : "026", "data" : [ [ "Perl", @@ -479,7 +473,6 @@ ] }, { - "name" : "027", "data" : [ [ "Perl", @@ -494,10 +487,10 @@ 9 ] ], - "id" : "027" + "id" : "027", + "name" |
