Skip to content

Commit

Permalink
Solve Selection Test 1 in clojure
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Nov 6, 2024
1 parent 41d5bd7 commit 05a045c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions solutions/beecrowd/1035/1035.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(ns main
(:require [clojure.string :as str]))

(defn accepted-values? [a b c d]
(and (> b c)
(> d a)
(> (+ c d) (+ a b))
(> c 0)
(> d 0)
(zero? (mod a 2))))

(defn main []
(loop [line (read-line)]
(when line
(let [[a b c d] (->> (str/split line #" ")
(map #(Integer/parseInt %)))]
(if (accepted-values? a b c d)
(printf "Valores aceitos%n")
(printf "Valores nao aceitos%n"))
(recur (read-line))))))

(main)

0 comments on commit 05a045c

Please sign in to comment.