fmt
fmt
This commit is contained in:
parent
88fa4fed05
commit
e48ca63881
1 changed files with 3 additions and 7 deletions
10
03b.lisp
10
03b.lisp
|
|
@ -20,18 +20,14 @@
|
||||||
(cl-heap:enqueue *queue* (list "" bank depth) 0)
|
(cl-heap:enqueue *queue* (list "" bank depth) 0)
|
||||||
(loop
|
(loop
|
||||||
do (defparameter *candidate* (apply #'bank-max-joltage-step (cl-heap:dequeue *queue*)))
|
do (defparameter *candidate* (apply #'bank-max-joltage-step (cl-heap:dequeue *queue*)))
|
||||||
when (integerp *candidate*)
|
when (integerp *candidate*) do (return *candidate*)
|
||||||
do (return *candidate*)
|
|
||||||
do (loop for branch in (reverse *candidate*)
|
do (loop for branch in (reverse *candidate*)
|
||||||
do (cl-heap:enqueue *queue* (cdr branch) (car branch)))
|
do (cl-heap:enqueue *queue* (cdr branch) (car branch)))))
|
||||||
)
|
|
||||||
)
|
|
||||||
(bank-max-joltage "234234234234278" 2)
|
(bank-max-joltage "234234234234278" 2)
|
||||||
(bank-max-joltage "234234234234278" 12)
|
(bank-max-joltage "234234234234278" 12)
|
||||||
|
|
||||||
(defun bank-max-joltage12 (bank)
|
(defun bank-max-joltage12 (bank)
|
||||||
(bank-max-joltage bank 12)
|
(bank-max-joltage bank 12))
|
||||||
)
|
|
||||||
(defun array-total-joltage (bank-list depth)
|
(defun array-total-joltage (bank-list depth)
|
||||||
(reduce #'+
|
(reduce #'+
|
||||||
(mapcar #'bank-max-joltage12 bank-list)))
|
(mapcar #'bank-max-joltage12 bank-list)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue