Skip to content

Commit f9b8909

Browse files
committed
Solve What is the Fastest? in clojure
1 parent 7bb81d1 commit f9b8909

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

solutions/beecrowd/2175/2175.clj

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
(ns main
2+
(:require [clojure.string :as str]))
3+
4+
(defn main []
5+
(loop [line (read-line)]
6+
(when line
7+
(let [[otavio bruno ian] (map #(Double/parseDouble %) (str/split line #" "))
8+
fastest (min otavio bruno ian)]
9+
(cond
10+
(and (= otavio fastest) (every? #(not= fastest %) [bruno ian]))
11+
(println "Otavio")
12+
(and (= bruno fastest) (every? #(not= fastest %) [otavio ian]))
13+
(println "Bruno")
14+
(and (= ian fastest) (every? #(not= fastest %) [otavio bruno]))
15+
(println "Ian")
16+
:else
17+
(println "Empate")))
18+
(recur (read-line)))))
19+
20+
(main)

0 commit comments

Comments
 (0)