Last active
March 5, 2017 03:40
-
-
Save chrisguitarguy/b26fa0df6aa3d3b7d4f68b0d4b9d89d6 to your computer and use it in GitHub Desktop.
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
#!/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