This commit is contained in:
Yanick Champoux 2018-02-28 14:58:20 -05:00
parent 3e113b9370
commit a4f4f9ed3b
2 changed files with 15 additions and 1 deletions

View File

@ -5,7 +5,6 @@ my $input = 3004953;
my @elves = 1..$input;
while( @elves > 1 ) {
say $elves[0];
push @elves, shift @elves;
shift @elves;
}

15
2016/19/2.pl Normal file
View File

@ -0,0 +1,15 @@
use 5.20.0;
my $input = 3004953;
my @elves = 1..$input;
my $j;
while( @elves > 1 ) {
say $elves[0] unless $j++ % 1000;
splice @elves, @elves/2, 1;
push @elves, shift @elves;
}
say @elves;