Princess's Gamble
(defun ticket (m p votes) (let ((sum-of (* (/ (- 100 p) 100) (* 100 (apply #'+ votes))))) (if (zerop (nth (1- m) votes)) 0 (floor (/ sum-of (nth (1- m) votes)))))) (defun main () (loop for n = (read) for m = (read) for p = (read) until (and (zerop n) (zerop m) (zerop p)) do (format t "~A~%" (ticket m p (loop for i from 1 upto n collect (read))))))