2016-03
This commit is contained in:
parent
458f8734fd
commit
fa621a4d25
16
2016/03/1.pl
Normal file
16
2016/03/1.pl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
use 5.20.0;
|
||||||
|
|
||||||
|
use Algorithm::Combinatorics qw/ partitions /;
|
||||||
|
use List::AllUtils qw/ sum any all /;
|
||||||
|
|
||||||
|
use DDP;
|
||||||
|
|
||||||
|
my $possible;
|
||||||
|
while(<>) {
|
||||||
|
my @x = split ' ';
|
||||||
|
use DDP; p @x;
|
||||||
|
next unless all { $x[$_] < sum( @x ) - $x[$_] } 0..2;
|
||||||
|
$possible++;
|
||||||
|
}
|
||||||
|
|
||||||
|
say $possible;
|
24
2016/03/2.pl
Normal file
24
2016/03/2.pl
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
use 5.20.0;
|
||||||
|
|
||||||
|
use Algorithm::Combinatorics qw/ partitions /;
|
||||||
|
use List::AllUtils qw/ sum any all natatime /;
|
||||||
|
|
||||||
|
use DDP;
|
||||||
|
|
||||||
|
my $possible;
|
||||||
|
my(@a,@b,@c);
|
||||||
|
while(<>) {
|
||||||
|
my @x = split ' ';
|
||||||
|
push @a, shift @x;
|
||||||
|
push @b, shift @x;
|
||||||
|
push @c, shift @x;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $it = natatime 3, @a, @b, @c;
|
||||||
|
|
||||||
|
while( my @x = $it->() ) {
|
||||||
|
next unless all { $x[$_] < sum( @x ) - $x[$_] } 0..2;
|
||||||
|
$possible++;
|
||||||
|
}
|
||||||
|
|
||||||
|
say $possible;
|
1902
2016/03/input.txt
Normal file
1902
2016/03/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user