src/2020/days/day-13.lisp @ cb7df3835cd1
Remove unused code, add comment
author |
Steve Losh <steve@stevelosh.com> |
date |
Fri, 17 Dec 2021 20:52:02 -0500 |
parents |
0b68f84e44ae |
children |
(none) |
(advent:defpackage* :advent/2020/13)
(in-package :advent/2020/13)
(defun parse (stream)
(cons (parse-integer (read-line stream))
(_ (read-line stream)
(str:split "," _)
(remove "x" _ :test #'string=)
(mapcar #'parse-integer _))))
(defun part1 (n buses)
(iterate (for b :in buses)
(for wait = (- (mod n (- b))))
(finding (* b wait) :minimizing wait)))
(define-problem (2020 13) (data parse) (174)
(destructuring-bind (n . buses) data
(values (part1 n buses))))
#; Scratch --------------------------------------------------------------------