(defun main (&rest argv) (declare (ignorable argv)) (let* ((*read-default-float-format* 'double-float) (n (read)) (k (read)) (dp1 (make-array (list 100 100) :element-type 'double-float :initial-element 0d0)) (dp2 (make-array (list 100 100) :element-type 'double-float :initial-element 0d0)) (res 0d0)) (setf (aref dp1 0 0) 1d0 (aref dp2 0 0) 1d0) (loop for i from 0 below n do (loop for j from 0 to (* 6 n) do (loop for k from 1 to 6 do (incf (aref dp1 (1+ i) (+ j k)) (/ (aref dp1 i j) 6))))) (loop for i from 0 below n do (loop for j from 0 to (* 6 n) if (< i (- n k)) do (loop for k from 1 to 6 do (incf (aref dp2 (1+ i) (+ j k)) (/ (aref dp2 i j) 6))) else do (loop for k from 4 to 6 do (incf (aref dp2 (1+ i) (+ j k)) (/ (aref dp2 i j) 3))))) (loop for i from 0 to (* 6 n) do (loop for j from 0 below i do (incf res (* (aref dp1 n j) (aref dp2 n i))))) (format t "~f~%" res))) (main)