Created
October 6, 2014 19:13
-
-
Save trendsetter37/a757034166bdcc14cfd3 to your computer and use it in GitHub Desktop.
Halloween Party Solution in clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;https://www.hackerrank.com/challenges/halloween-party | |
(defn determine_pieces [number] | |
(if (= (mod number 2) 0) | |
(* (/ number 2) (/ number 2)) | |
(* (quot number 2) (+ (quot number 2) 1)))) ;quot is clojure's version of non-float division | |
(dotimes [i (Integer/parseInt (read-line))] | |
(let [input (Integer/parseInt (read-line))] | |
(println (determine_pieces input)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment