This commit is contained in:
Yanick Champoux 2017-12-08 13:19:49 -05:00
parent 88fc836bd5
commit 78d3e14c07
3 changed files with 1033 additions and 0 deletions

16
08/1.pl Normal file
View File

@ -0,0 +1,16 @@
use 5.20.0;
my %reg;
while(<>) {
s/^(\w+)/\$reg{$1}/;
s/(?<=if )(\w+)/\$reg{$1}/;
s/dec/-=/;
s/inc/+=/;
eval;
}
use List::UtilsBy qw/ max_by /;
use List::AllUtils qw/ max /;
say max values %reg;

17
08/2.pl Normal file
View File

@ -0,0 +1,17 @@
use 5.20.0;
use List::AllUtils qw/ max /;
my %reg;
my $max;
while(<>) {
s/^(\w+)/\$reg{$1}/;
s/(?<=if )(\w+)/\$reg{$1}/;
s/dec/-=/;
s/inc/+=/;
eval;
$max = max $max, values %reg;
}
say $max;

1000
08/input.txt Normal file

File diff suppressed because it is too large Load Diff