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
|
;; solution for day 6
|
||||||
|
|
||||||
(define *fudge* 1e-10)
|
|
||||||
|
|
||||||
(define (do-race time dist)
|
(define (do-race time dist)
|
||||||
(match-define (list lower upper) (quadratic-solutions 1 (- time) dist))
|
(match-define (list lower upper)
|
||||||
(~> (- (floor (- upper *fudge*)) (ceiling (+ lower *fudge*)))
|
(quadratic-solutions 1 (- time) dist))
|
||||||
add1 inexact->exact))
|
(inexact->exact (- (ceiling upper) (add1 (floor lower)))))
|
||||||
|
|
||||||
(define (part1 input)
|
(define (part1 input)
|
||||||
(for/product ([time (in-list (first input))]
|
(for/product ([time (in-list (first input))]
|
||||||
|
|
Loading…
Reference in New Issue