Skip to content

Commit

Permalink
Solve UFPR Gaming in clojure
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Dec 14, 2024
1 parent f9b8909 commit 108faf9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions solutions/beecrowd/2543/2543.clj
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 108faf9

Please sign in to comment.