Skip to content

Commit 108faf9

Browse files
committed
Solve UFPR Gaming in clojure
1 parent f9b8909 commit 108faf9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

solutions/beecrowd/2543/2543.clj

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
(ns main
2+
(:require [clojure.string :as str]))
3+
4+
(defn count-contra-strike-gameplay [n university-id]
5+
(loop [index 0
6+
count-gameplay 0]
7+
(if (< index n)
8+
(let [[id gameplay] (map #(Integer/parseInt %) (str/split (read-line) #" "))]
9+
(if (and (= id university-id) (= gameplay 0))
10+
(recur (inc index) (inc count-gameplay))
11+
(recur (inc index) count-gameplay)))
12+
count-gameplay)))
13+
14+
(defn main []
15+
(loop [line (read-line)]
16+
(when line
17+
(let [[n university-id] (map #(Integer/parseInt %) (str/split line #" "))]
18+
(println (count-contra-strike-gameplay n university-id)))
19+
(recur (read-line)))))
20+
21+
(main)

0 commit comments

Comments
 (0)