Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Periodic-table/Perl/periodic-table.pl
Normal file
15
Task/Periodic-table/Perl/periodic-table.pl
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use strict;
|
||||
use warnings; no warnings 'uninitialized';
|
||||
use feature 'say';
|
||||
use List::Util <sum head>;
|
||||
|
||||
sub divmod { int $_[0]/$_[1], $_[0]%$_[1] }
|
||||
|
||||
my $b = 18;
|
||||
my(@offset,@span,$cnt);
|
||||
push @span, ($cnt++) x $_ for <1 3 8 44 15 17 15 15>;
|
||||
@offset = (16, 10, 10, (2*$b)+1, (-2*$b)-15, (2*$b)+1, (-2*$b)-15);
|
||||
|
||||
for my $n (<1 2 29 42 57 58 72 89 90 103 118>) {
|
||||
printf "%3d: %2d, %2d\n", $n, map { $_+1 } divmod $n-1 + sum(head $span[$n-1], @offset), $b;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue