day 1
This commit is contained in:
parent
f4aba7ad51
commit
ea12a2762e
9
day1/day1.pl
Normal file
9
day1/day1.pl
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env perl -n
|
||||||
|
|
||||||
|
use 5.20.0;
|
||||||
|
use List::AllUtils qw/ sum /;
|
||||||
|
|
||||||
|
chomp;
|
||||||
|
$_ .= substr $_, 0, 1;
|
||||||
|
|
||||||
|
say sum /(.)(?=\1)/g;
|
9
day1/day1b.pl
Executable file
9
day1/day1b.pl
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env perl -n
|
||||||
|
|
||||||
|
use 5.20.0;
|
||||||
|
use List::AllUtils qw/ sum /;
|
||||||
|
|
||||||
|
chomp;
|
||||||
|
my @n = split '';
|
||||||
|
|
||||||
|
say sum @n[ grep { $n[$_] == $n[($_+@n/2)%@n] } 0..$#n ]
|
Loading…
Reference in New Issue
Block a user