part1
This commit is contained in:
parent
6d306ef5ea
commit
4df9256d63
4
23/2.pl
4
23/2.pl
@ -12,9 +12,9 @@ while(<>) {
|
||||
}
|
||||
|
||||
for ( 1..35 ) {
|
||||
my @c = $script =~ /(L$_: )/g;
|
||||
my @c = $script =~ /(L$_[ :])/g;
|
||||
next if @c > 1;
|
||||
$script =~ s/L$_: //g;
|
||||
$script =~ s/L$_[ :] *//g;
|
||||
}
|
||||
|
||||
print $script;
|
||||
|
41
23/2b.pl
41
23/2b.pl
@ -1,33 +1,16 @@
|
||||
$a = 1;
|
||||
$b = 79;
|
||||
$c = $b;
|
||||
($a,$b,$c) = (1,79,79);
|
||||
goto L5 if $a;
|
||||
goto L9 if 1;
|
||||
L5: $b *= 100;
|
||||
$b -= -100000;
|
||||
$c = $b;
|
||||
$c -= -17000;
|
||||
L9: $f = 1;
|
||||
$d = 2;
|
||||
L11: $e = 2;
|
||||
L12: $g = $d;
|
||||
$g *= $e;
|
||||
$g -= $b;
|
||||
goto L17 if $g;
|
||||
$f = 0;
|
||||
L17: $e -= -1;
|
||||
$g = $e;
|
||||
$g -= $b;
|
||||
goto L12 if $g;
|
||||
$d -= -1;
|
||||
$g = $d;
|
||||
$g -= $b;
|
||||
goto L11 if $g;
|
||||
goto L27 if $f;
|
||||
$h -= -1;
|
||||
L27: $g = $b;
|
||||
$g -= $c;
|
||||
goto L31 if $g;
|
||||
goto if 1;
|
||||
L31: $b -= -17;
|
||||
goto L9 if 1;
|
||||
while() {
|
||||
warn $b;
|
||||
($f,$d) = (1,2);
|
||||
do {
|
||||
$e = 2;
|
||||
$f = 0 if not $b % $d;
|
||||
} while ++$d - $b;
|
||||
$h++ unless $f;
|
||||
die $h if $b == 124900;
|
||||
$b += 17;
|
||||
}
|
||||
|
28
24/1.pl
Normal file
28
24/1.pl
Normal file
@ -0,0 +1,28 @@
|
||||
use 5.20.0;
|
||||
use experimental qw/ signatures postderef smartmatch /;
|
||||
use List::AllUtils qw/ sum max first_index /;
|
||||
my @elements = map { chomp; [ split '/' ] } <>;
|
||||
|
||||
use DDP;
|
||||
|
||||
say build_bridge(0,0,@elements);
|
||||
|
||||
sub build_bridge( $sofar = 0, $connector = 0, @left ) {
|
||||
# warn scalar @left;
|
||||
# p @_;
|
||||
# my $summy = <STDIN>;
|
||||
|
||||
my $max = $sofar;
|
||||
|
||||
for my $i ( 0..$#left ) {
|
||||
next unless $connector ~~ $left[$i]->@*;
|
||||
my @copy = @left;
|
||||
my $i = splice @copy, $i, 1;
|
||||
my $next_con = $i->[ 1 - first_index { $_ == $connector } @$i ];
|
||||
$max = max $max, build_bridge( $sofar + sum( @$i ), $next_con, @copy );
|
||||
}
|
||||
|
||||
return $max;
|
||||
}
|
||||
|
||||
|
56
24/input.txt
Normal file
56
24/input.txt
Normal file
@ -0,0 +1,56 @@
|
||||
31/13
|
||||
34/4
|
||||
49/49
|
||||
23/37
|
||||
47/45
|
||||
32/4
|
||||
12/35
|
||||
37/30
|
||||
41/48
|
||||
0/47
|
||||
32/30
|
||||
12/5
|
||||
37/31
|
||||
7/41
|
||||
10/28
|
||||
35/4
|
||||
28/35
|
||||
20/29
|
||||
32/20
|
||||
31/43
|
||||
48/14
|
||||
10/11
|
||||
27/6
|
||||
9/24
|
||||
8/28
|
||||
45/48
|
||||
8/1
|
||||
16/19
|
||||
45/45
|
||||
0/4
|
||||
29/33
|
||||
2/5
|
||||
33/9
|
||||
11/7
|
||||
32/10
|
||||
44/1
|
||||
40/32
|
||||
2/45
|
||||
16/16
|
||||
1/18
|
||||
38/36
|
||||
34/24
|
||||
39/44
|
||||
32/37
|
||||
26/46
|
||||
25/33
|
||||
9/10
|
||||
0/29
|
||||
38/8
|
||||
33/33
|
||||
49/19
|
||||
18/20
|
||||
49/39
|
||||
18/39
|
||||
26/13
|
||||
19/32
|
Loading…
Reference in New Issue
Block a user