【AtCoder ABC375B】Traveling Takahashi Problem

(defun move-cost (p q)
  (declare (type list p q))
  (sqrt (+ (square (- (car p) (car q)))
	   (square (- (cadr p) (cadr q)))
	   0.0l0)))

(defun square (x)
  (* x x))

(defun total-move-cost (lst)
  (loop for (p q) on lst
	until (null q)
	sum (move-cost p q)))

(defun main ()
  (let* ((n (read))
	 (lst (loop for i from 0 to (1+ n)
		    if (or (= i 0) (= i (1+ n)))
		      collect (list 0 0)
		    else
		      collect (list (read) (read)))))
    (format t "~f" (total-move-cost lst))))

#-swank(main)
Code language: Lisp (lisp)