Skip to content

Instantly share code, notes, and snippets.

@ardfard
Created September 4, 2015 06:02
Show Gist options
  • Save ardfard/853cfda2e6a3948f59db to your computer and use it in GitHub Desktop.
Save ardfard/853cfda2e6a3948f59db to your computer and use it in GitHub Desktop.
-- Enter your code here. Read input from STDIN. Print output to STDOUT
{-# Language OverloadedStrings #-}
import Control.Monad
import qualified Data.Text as T
import qualified Data.Text.IO as TIO
import qualified Data.Text.Read as TR
main :: IO()
main = parseInput >>= (mapM_ print) . applySolution
where
applySolution = map solution
parseInput :: IO [[Integer]]
parseInput = do
numCase <- readLn :: IO Int
forM [1..numCase] $ \_ -> do
let parse = sequence . (map TR.decimal) . (T.splitOn " ")
inputs <- fmap parse TIO.getLine
case inputs of
Right xs -> return $ map fst xs
_ -> return []
-- create your solution here
solution :: [Integer] -> Integer
solution = undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment