diff --git a/solutions/beecrowd/1158/1158.clj b/solutions/beecrowd/1158/1158.clj new file mode 100644 index 00000000..7880cfe0 --- /dev/null +++ b/solutions/beecrowd/1158/1158.clj @@ -0,0 +1,18 @@ +(ns main + (:require [clojure.string :as str])) + +(defn sum-odd-number [start quantity] + (->> (iterate inc start) + (filter odd?) + (take quantity) + (reduce +))) + +(defn main [] + (loop [n (Integer/parseInt (read-line))] + (when (> n 0) + (let [[x y] (->> (str/split (read-line) #" ") + (map #(Integer/parseInt %)))] + (println (sum-odd-number x y)) + (recur (dec n)))))) + +(main)