Skip to content

Instantly share code, notes, and snippets.

@TonyMooori
Created July 23, 2018 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TonyMooori/e1d8c4dc19d89587f3aca15133b955ab to your computer and use it in GitHub Desktop.
Save TonyMooori/e1d8c4dc19d89587f3aca15133b955ab to your computer and use it in GitHub Desktop.
アルゴリズムパズル 4 兵士の輸送
(defun solve-4 (n-soldier n)
(if (= n-soldier 0)
(print (format nil "~{~A~}" (list "it takes " (write-to-string n) " steps.")))
(progn
(print "2 young man go to left.")
(print "1 young man go to right")
(print "1 soldier go to left.")
(print "1 young man go to right.")
(solve-4 (1- n-soldier) (+ 4 n)))))
(solve-4 25 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment