main
Yanick Champoux 2017-12-13 10:28:31 -05:00
parent 2b88e2660e
commit 57d29c68d0
4 changed files with 86 additions and 0 deletions

16
13/1.pl Normal file
View File

@ -0,0 +1,16 @@
use 5.20.0;
use List::AllUtils qw/ /;
use experimental qw/ signatures postderef /;
my %g = map { split ': ' } <>;
my $score;
for my $g ( keys %g ) {
next if $g % (2*($g{$g}-1));
warn $g;
$score += $g * $g{$g};
}
say $score;

23
13/2.pl Normal file
View File

@ -0,0 +1,23 @@
use 5.20.0;
use List::AllUtils qw/ /;
use experimental qw/ signatures postderef /;
my %g = map { split ': ' } <>;
my $i = 1;
until( pass($i) ) {
$i++;
}
say '>>>',$i;
sub pass($i) {
for my $g ( keys %g ) {
return unless ($i+$g) % (2*($g{$g}-1));
}
return 1;
}

43
13/input.txt Normal file
View File

@ -0,0 +1,43 @@
0: 4
1: 2
2: 3
4: 5
6: 8
8: 4
10: 6
12: 6
14: 6
16: 10
18: 6
20: 12
22: 8
24: 9
26: 8
28: 8
30: 8
32: 12
34: 12
36: 12
38: 8
40: 10
42: 14
44: 12
46: 14
48: 12
50: 12
52: 12
54: 14
56: 14
58: 14
60: 12
62: 14
64: 14
68: 12
70: 14
74: 14
76: 14
78: 14
80: 17
82: 28
84: 18
86: 14

4
13/test Normal file
View File

@ -0,0 +1,4 @@
0: 3
1: 2
4: 4
6: 4