Skip to content

Instantly share code, notes, and snippets.

@chrisguitarguy
Last active March 5, 2017 03:40
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 chrisguitarguy/b26fa0df6aa3d3b7d4f68b0d4b9d89d6 to your computer and use it in GitHub Desktop.
Save chrisguitarguy/b26fa0df6aa3d3b7d4f68b0d4b9d89d6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env boot
(require '[clojure.string :as string])
(defn- str->int [s]
(Integer/parseInt s))
(defn- round-grade [grade]
(let [r (mod grade 5)]
(if (>= r 3)
(+ grade (- 5 r))
grade)))
(defn- final-grade [grade]
(if (< grade 38)
grade
(round-grade grade)))
(defn -main [& args]
(let [total (str->int (read-line))
grades (map str->int (repeatedly total read-line))]
(doseq [fg (map final-grade grades)]
(println fg))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment