Create a gist now

Instantly share code, notes, and snippets.

@katsuyan /q4.clj
Last active Dec 2, 2016

What would you like to do?
数学パズルonClojure-Q4
(defn cutbar-rec [m n current-num]
(cond
(>= current-num n) 0
(< current-num m) (inc (cutbar-rec m n (* 2 current-num)))
:else (inc (cutbar-rec m n (+ current-num m)))))
(defn cutbar [m n]
(cutbar-rec m n 1))
(def answer-1 (cutbar 3 20))
(def answer-2 (cutbar 5 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment