aboutsummaryrefslogtreecommitdiff
path: root/advent-of-code/2022/01/1.rkt
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2024-02-17 12:27:24 +0800
committerMistivia <i@mistivia.com>2024-02-17 12:27:24 +0800
commit8fcd7e1ed30a8b04d4d658b2d8c6acad938424d4 (patch)
tree1cf064396cb0ddfdf77b2d3d6b56ebdd27c0ba9b /advent-of-code/2022/01/1.rkt
parent050fa7cbfb6b7cf293fb02e06daf123b3e6af816 (diff)
add aoc 2022
Diffstat (limited to 'advent-of-code/2022/01/1.rkt')
-rw-r--r--advent-of-code/2022/01/1.rkt15
1 files changed, 15 insertions, 0 deletions
diff --git a/advent-of-code/2022/01/1.rkt b/advent-of-code/2022/01/1.rkt
new file mode 100644
index 0000000..340a531
--- /dev/null
+++ b/advent-of-code/2022/01/1.rkt
@@ -0,0 +1,15 @@
+#lang racket/base
+
+(require "../../lib/utils.rkt")
+
+(define lines
+ (call-with-input-file "input"
+ (lambda (fp)
+ (get-lines fp))))
+
+(define elves (split-list-by "" lines))
+
+(define (elf-sum elf)
+ (apply + (map string->number elf)))
+
+(apply max (map elf-sum elves)) \ No newline at end of file