Codeforces 37A - A. Towers
import Data.List calc :: [Int] -> (Int, Int) calc xs = (maximum [count x xs | x <- xs], length $ nub xs) where count a xs = sum [1 | x <- xs, x == a] main = do s <- getLine t <- getLine let (x, y) = calc $ map read $ words t putStrLn (show x ++ " " ++ show y)
個数を求めるのに、1 からなるリストを sum するのはどうも好きになれない。他に良い方法はないだろうか。