|
|
@ -1,7 +1,6 @@
|
|
|
|
(require '[clojure.string :as str])
|
|
|
|
(require '[clojure.string :as str])
|
|
|
|
|
|
|
|
|
|
|
|
(println
|
|
|
|
(->> "./in"
|
|
|
|
(->> "./in"
|
|
|
|
|
|
|
|
(slurp)
|
|
|
|
(slurp)
|
|
|
|
(str/split-lines)
|
|
|
|
(str/split-lines)
|
|
|
|
(map (fn [l] (map #(if (= % \1) 1 0) l)))
|
|
|
|
(map (fn [l] (map #(if (= % \1) 1 0) l)))
|
|
|
@ -10,7 +9,7 @@
|
|
|
|
(str/join)
|
|
|
|
(str/join)
|
|
|
|
(#(Integer/parseInt % 2))
|
|
|
|
(#(Integer/parseInt % 2))
|
|
|
|
(#(* % (bit-xor % (dec (int (Math/pow 2 12))))))
|
|
|
|
(#(* % (bit-xor % (dec (int (Math/pow 2 12))))))
|
|
|
|
)
|
|
|
|
(println)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
; (->> input data file name
|
|
|
|
; (->> input data file name
|
|
|
@ -22,4 +21,5 @@
|
|
|
|
; join characters into single string
|
|
|
|
; join characters into single string
|
|
|
|
; convert binary string to a number (gamma)
|
|
|
|
; convert binary string to a number (gamma)
|
|
|
|
; multiply gamma by its bit-inverse (bit length hard-coded)
|
|
|
|
; multiply gamma by its bit-inverse (bit length hard-coded)
|
|
|
|
|
|
|
|
; print results
|
|
|
|
|
|
|
|
|
|
|
|