thanks tali

This commit is contained in:
xenia 2023-12-06 02:21:06 -05:00
parent 05a24a6ac4
commit 0dc8f77ac8
1 changed files with 3 additions and 5 deletions

8
6.rkt
View File

@ -4,12 +4,10 @@
;; solution for day 6
(define *fudge* 1e-10)
(define (do-race time dist)
(match-define (list lower upper) (quadratic-solutions 1 (- time) dist))
(~> (- (floor (- upper *fudge*)) (ceiling (+ lower *fudge*)))
add1 inexact->exact))
(match-define (list lower upper)
(quadratic-solutions 1 (- time) dist))
(inexact->exact (- (ceiling upper) (add1 (floor lower)))))
(define (part1 input)
(for/product ([time (in-list (first input))]