Created
June 20, 2016 15:34
-
-
Save fbrubacher/d0a55f6e5abbefe5ea16c271514b517e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import Control.Applicative | |
import Control.Monad | |
import Data.List | |
main = (enumFromTo 1 <$> readLn) >>= mapM_ (\caseno -> do | |
getLine | |
x <- map read . words <$> getLine | |
y <- map read . words <$> getLine | |
let answer = sum $ zipWith (*) (sort x) (reverse $ sort y) | |
putStrLn $ "Case #" ++ show caseno ++ ": " ++ show answer | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment