about summary refs log tree commit diff
path: root/day15.k
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-12-15 15:14:32 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2015-12-15 15:14:32 +0100
commit2c7509233aebb59f2168b27e3d704dc0d6ad725f (patch)
treed5ae578ba6602f34a1c3e0b95f5a9006c222f10d /day15.k
parente8ee73c2b058529ee427f89e388dc012bc354fbb (diff)
downloadadventofcode2015-2c7509233aebb59f2168b27e3d704dc0d6ad725f.tar.gz
adventofcode2015-2c7509233aebb59f2168b27e3d704dc0d6ad725f.tar.xz
adventofcode2015-2c7509233aebb59f2168b27e3d704dc0d6ad725f.zip
day15
Diffstat (limited to 'day15.k')
-rw-r--r--day15.k12
1 files changed, 12 insertions, 0 deletions
diff --git a/day15.k b/day15.k
new file mode 100644
index 0000000..241f5fe
--- /dev/null
+++ b/day15.k
@@ -0,0 +1,12 @@
+d:0:"day15";
+ss:{1 _' (&y=y,x) _ y,x}; / split x at y
+l:ss[;" "]' d;
+v:{0$' -1 _' x@2 4 6 8}'l; / valuations
+c:{0$' -1 _' x@10}'l; / calories
+
+n:{x,100-+/x}'!3#100;
+n:n@&&/'1<n; / only positive ingredients
+|/{*/0|+/v*x}'n
+
+n:n@&{500=+/c*x}'n; / only 500 calories
+|/{*/0|+/v*x}'n