thanks tali
This commit is contained in:
parent
05a24a6ac4
commit
0dc8f77ac8
8
6.rkt
8
6.rkt
|
@ -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))]
|
||||
|
|
Loading…
Reference in New Issue