summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-12-01 14:16:11 -0500
committerJune McEnroe <june@causal.agency>2022-12-01 14:16:11 -0500
commit79c8f67a9e9f0ac208d7449b861e3cdec2180003 (patch)
tree97f9bf93c09e9f81ad9b368f5e9a297e7a9ba927
parentSolve day 14 part 2 (diff)
downloadaoc-79c8f67a9e9f0ac208d7449b861e3cdec2180003.tar.gz
aoc-79c8f67a9e9f0ac208d7449b861e3cdec2180003.zip
Solve day 1 part 1
-rw-r--r--2022/day01.awk10
1 files changed, 10 insertions, 0 deletions
diff --git a/2022/day01.awk b/2022/day01.awk
new file mode 100644
index 0000000..c81d624
--- /dev/null
+++ b/2022/day01.awk
@@ -0,0 +1,10 @@
+/[[:digit:]]+/ {
+	cals += $1;
+}
+/^$/ {
+	if (cals > max) max = cals;
+	cals = 0;
+}
+END {
+	print max;
+}