Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

AoC/2017/1

(ns clojure.examples.hello
	(:gen-class))
	
(require '[clojure.string :as str])

(defn uno [s]
    (let [l (map read-string (str/split s #""))]
    (apply + (keep-indexed #(if (= (nth l (mod (inc %1) (count l))) %2) %2) l))))

(defn duo [s]
    (let [l (map read-string (str/split s #""))]
    (apply + (keep-indexed #(if (= (nth l (mod (+ %1 (/ (count l) 2)) (count l))) %2) %2) l))))
    
(println (uno (read-line)))

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.