adventofcode/2017/17/1.pl

16 lines
189 B
Perl
Raw Permalink Normal View History

2017-12-17 16:39:52 +00:00
use 5.20.0;
my $i = 380;
my @v = (0);
my $p = 0;
use DDP;
for(1..2017) {
$p = ( 1 + $p + $i ) % @v;
2017-12-28 17:15:15 +00:00
if($p) { splice @v, $p, 0, $_; }
else { push @v, $_; $p = $#v };
2017-12-17 16:39:52 +00:00
}
p @v;