]> www.fi.muni.cz Git - aoc.git/blob - 2016/32.pl
The rest of Year 2016
[aoc.git] / 2016 / 32.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use v5.30;
5
6 my $in = '00101000101111010';
7 my $len = 35651584;
8
9 while (length($in) < $len) {
10         my $l1 = join('', reverse split(//, $in));
11         $l1 =~ y/01/10/;
12         $in .= '0' . $l1;
13 }
14
15 $in = substr($in, 0, $len);
16 while (length($in) % 2 == 0) {
17         my $l1 = '';
18         while ($in =~ /../g) {
19                 $l1 .= ($& eq '11' || $& eq '00') ? '1' : '0';
20         }
21         $in = $l1;
22 }
23
24 say $in;
25
26