Skip to content

Instantly share code, notes, and snippets.

@yingtai
Created May 27, 2012 12:53
Show Gist options
  • Select an option

  • Save yingtai/2814108 to your computer and use it in GitHub Desktop.

Select an option

Save yingtai/2814108 to your computer and use it in GitHub Desktop.
AtCoder #003
import Control.Applicative
f n xs = (/ n) $ foldr1 (+) $ map g xs where
g ch | ch == 'A' = 4
| ch == 'B' = 3
| ch == 'C' = 2
| ch == 'D' = 1
| ch == 'F' = 0
main = do
n <- read<$>getLine
xs <- getLine
print $ f n xs
import Data.List
main = do
n <- getLine
xs <- getContents
putStr $ unlines $ map reverse $ sort $ map reverse $ lines xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment