diff options
author | Leah Neukirchen <leah@vuxu.org> | 2019-12-02 16:18:01 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2019-12-02 16:18:01 +0100 |
commit | 95e458366fac25a992307d4acc396d143345c102 (patch) | |
tree | 1b4e8b4acd3494c7dd13de2d9ed291f1fd913995 | |
parent | 5c8645076e289f3f49574b8f2fa01e42f11c6f5d (diff) | |
download | adventofcode2019-95e458366fac25a992307d4acc396d143345c102.tar.gz adventofcode2019-95e458366fac25a992307d4acc396d143345c102.tar.xz adventofcode2019-95e458366fac25a992307d4acc396d143345c102.zip |
day01
-rw-r--r-- | day01 | 100 | ||||
-rw-r--r-- | day01.k | 5 | ||||
-rw-r--r-- | day01.pl | 14 |
3 files changed, 119 insertions, 0 deletions
diff --git a/day01 b/day01 new file mode 100644 index 0000000..4fb4fe7 --- /dev/null +++ b/day01 @@ -0,0 +1,100 @@ +144365 +124674 +99039 +132924 +126960 +103950 +78451 +123596 +119950 +116772 +134137 +50247 +99543 +147151 +103063 +59247 +59281 +141531 +104417 +75105 +57868 +149148 +76973 +87424 +135220 +141885 +106241 +128482 +54020 +67575 +97719 +110237 +137361 +70772 +103397 +117471 +99611 +142905 +135345 +122338 +62708 +103663 +146189 +81657 +126628 +133113 +135399 +52731 +116597 +61749 +61519 +56234 +64306 +127237 +133320 +79782 +132431 +142449 +91926 +146277 +55314 +111507 +126347 +124086 +120868 +127433 +126838 +77814 +144388 +86786 +134780 +109082 +101772 +140013 +100282 +115632 +73057 +139318 +85633 +67693 +55545 +53545 +125871 +115201 +105202 +148104 +68677 +64761 +54368 +110380 +102082 +106684 +89933 +71703 +147332 +99699 +98447 +96963 +148686 +92651 diff --git a/day01.k b/day01.k new file mode 100644 index 0000000..05be02f --- /dev/null +++ b/day01.k @@ -0,0 +1,5 @@ ++/(-2+3/)d:`i$0:`day01 ++//0|1_(-2+3/)\d +\\ +3488702 +5230169 diff --git a/day01.pl b/day01.pl new file mode 100644 index 0000000..d81b7fa --- /dev/null +++ b/day01.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -w +use v5.16; + +use File::Slurper 'read_lines'; +use List::Util 'sum'; +use integer; + +my @d = read_lines "day01"; + +say sum map { $_/3-2 } @d; + +my $p2 = 0; +map { $p2 += $_ while ($_ = $_/3-2) > 0} @d; +say $p2; |