aboutsummaryrefslogtreecommitdiff
path: root/challenge-001
diff options
context:
space:
mode:
authorPaulo Custodio <pauloscustodio@gmail.com>2023-03-28 22:30:00 +0100
committerPaulo Custodio <pauloscustodio@gmail.com>2023-03-28 22:30:00 +0100
commitef8d61e1ac031bdec1c500dbde3d1cc84c9530c8 (patch)
treecbd72796d93b61005832c93bb212a595c1a5a193 /challenge-001
parente4a9f1784f39bdc57d634146553819237e7762fd (diff)
downloadperlweeklychallenge-club-ef8d61e1ac031bdec1c500dbde3d1cc84c9530c8.tar.gz
perlweeklychallenge-club-ef8d61e1ac031bdec1c500dbde3d1cc84c9530c8.tar.bz2
perlweeklychallenge-club-ef8d61e1ac031bdec1c500dbde3d1cc84c9530c8.zip
Show more stats
Diffstat (limited to 'challenge-001')
-rw-r--r--challenge-001/paulo-custodio/stats.pl37
1 files changed, 37 insertions, 0 deletions
diff --git a/challenge-001/paulo-custodio/stats.pl b/challenge-001/paulo-custodio/stats.pl
index bc344a2db3..cf9947a329 100644
--- a/challenge-001/paulo-custodio/stats.pl
+++ b/challenge-001/paulo-custodio/stats.pl
@@ -62,3 +62,40 @@ for my $chall (1 .. $#sols) {
}
say "";
}
+
+say "";
+
+for my $lang (sort keys %LANG) {
+ my @list;
+ my $count=0;
+ for my $chall (1 .. $#sols) {
+ push @list, $chall if ($sols[$chall]{$lang}//0)==2;
+ $count+=$sols[$chall]{$lang}//0;
+ }
+ say sprintf("%-12s(%4d) ", $lang, $count), list_compreension(@list);
+}
+
+sub list_compreension {
+ my(@in) = @_;
+ my @out;
+ while (@in) {
+ if (@in==1) {
+ push @out, shift @in;
+ }
+ else {
+ my $i=0;
+ while ($i<@in && $in[$i]==$in[0]+$i) { $i++; }
+ if ($i==1) {
+ push @out, shift @in;
+ }
+ else {
+ push @out, $in[0]."-".$in[$i-1];
+ splice(@in,0,$i);
+ }
+ }
+ }
+ return join(",", @out);
+}
+
+
+