Created
April 15, 2012 01:54
-
-
Save mnzk/2389314 to your computer and use it in GitHub Desktop.
atcoder-q001-a.clj
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
;; AtCoder 過去問 : 001-A 【センター採点】 | |
;; http://arc001.contest.atcoder.jp/tasks/arc001_1 | |
(defn q001-a* | |
[N cs] | |
(let [lafi (juxt last first)] | |
(->> cs | |
(reduce (fn [m c] (assoc m c (inc (m c)))) | |
{\1 0 \2 0 \3 0 \4 0}) | |
vals (into (sorted-set)) | |
lafi))) | |
(defn q001-a | |
[] | |
(let [N (Long/parseLong (read-line)) | |
cs (take N (read-line)) | |
[a b] (q001-a* N cs)] | |
(println a b))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment