aboutsummaryrefslogtreecommitdiff
path: root/advent-of-code/2023/06/2.rkt
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2024-02-25 20:11:54 +0800
committerMistivia <i@mistivia.com>2024-02-25 20:11:54 +0800
commit515ecbf5a20a8e432a998b0a543bedcb1bd64cf4 (patch)
tree6353c603a8cf0276553f420205f8d1c730a318ce /advent-of-code/2023/06/2.rkt
parente191b610c11326b587cf0b01fd6fc37b8d07bb19 (diff)
reorg code
Diffstat (limited to 'advent-of-code/2023/06/2.rkt')
-rw-r--r--advent-of-code/2023/06/2.rkt29
1 files changed, 0 insertions, 29 deletions
diff --git a/advent-of-code/2023/06/2.rkt b/advent-of-code/2023/06/2.rkt
deleted file mode 100644
index 2d666ed..0000000
--- a/advent-of-code/2023/06/2.rkt
+++ /dev/null
@@ -1,29 +0,0 @@
-#lang racket
-
-(define in (open-input-file "input"))
-
-(define (read-num)
- (define line (read-line in))
- (string->number
- (apply
- string-append
- (string-split
- (cadr (string-split (string-trim line) ":"))))))
-
-(define time (read-num))
-(define distance (read-num))
-
-(define (calc time hold-time)
- (* hold-time (- time hold-time)))
-
-(define (solve time distance)
- (define (loop counter hold-time)
- (if (> hold-time time)
- counter
- (if (> (calc time hold-time) distance)
- (loop (+ 1 counter) (+ 1 hold-time))
- (loop counter (+ 1 hold-time)))))
- (loop 0 0))
-
-(display (solve time distance))
-(newline)