diff --git a/solutions/beecrowd/2543/2543.clj b/solutions/beecrowd/2543/2543.clj new file mode 100644 index 00000000..80e89192 --- /dev/null +++ b/solutions/beecrowd/2543/2543.clj @@ -0,0 +1,21 @@ +(ns main + (:require [clojure.string :as str])) + +(defn count-contra-strike-gameplay [n university-id] + (loop [index 0 + count-gameplay 0] + (if (< index n) + (let [[id gameplay] (map #(Integer/parseInt %) (str/split (read-line) #" "))] + (if (and (= id university-id) (= gameplay 0)) + (recur (inc index) (inc count-gameplay)) + (recur (inc index) count-gameplay))) + count-gameplay))) + +(defn main [] + (loop [line (read-line)] + (when line + (let [[n university-id] (map #(Integer/parseInt %) (str/split line #" "))] + (println (count-contra-strike-gameplay n university-id))) + (recur (read-line))))) + +(main)