Skip to content

Instantly share code, notes, and snippets.

@trendsetter37
Created October 6, 2014 19:13
Show Gist options
  • Save trendsetter37/a757034166bdcc14cfd3 to your computer and use it in GitHub Desktop.
Save trendsetter37/a757034166bdcc14cfd3 to your computer and use it in GitHub Desktop.
Halloween Party Solution in clojure
;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