-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41d5bd7
commit 05a045c
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |