Created
February 22, 2015 05:35
-
-
Save LispyAriaro/37d1ee0face3557cc8f9 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
(defn my-fac [num] | |
(if (zero? num) | |
1 | |
(reduce * (range 1 (inc num))))) | |
(defn get-input [] | |
(let [num-tests (read-line) | |
num-tests-as-num (Integer/parseInt num-tests) | |
the-test-cases-as-num (for [a-case (range 0 num-tests-as-num)] | |
(Double/parseDouble (read-line))) | |
the-Es (for [a-case the-test-cases-as-num] | |
(reduce + (for [counter (range 0 10)] | |
(/ (Math/pow a-case counter) (my-fac counter)))))] | |
(doseq [an-e the-Es] | |
(println an-e)))) | |
(get-input) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment