2016-19
This commit is contained in:
parent
3e113b9370
commit
a4f4f9ed3b
@ -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
15
2016/19/2.pl
Normal 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;
|
Loading…
Reference in New Issue
Block a user