Skip to content

Instantly share code, notes, and snippets.

@mnzk
Created April 15, 2012 01:54
Show Gist options
  • Save mnzk/2389314 to your computer and use it in GitHub Desktop.
Save mnzk/2389314 to your computer and use it in GitHub Desktop.
atcoder-q001-a.clj
;; 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