Skip to content

Instantly share code, notes, and snippets.

@h-hirai
Created May 13, 2010 02:02
Show Gist options
  • Save h-hirai/399394 to your computer and use it in GitHub Desktop.
Save h-hirai/399394 to your computer and use it in GitHub Desktop.
module GCJ (runSolver) where
runSolver :: (Int -> [String] -> [a]) ->
(a -> String) ->
String -> String
runSolver splitter solver s =
let ls = lines s
n = read $ head ls
ins = splitter n $ tail ls
in
unlines $ zipWith formatter [1..] $ map solver ins
where
formatter :: Int -> String -> String
formatter c s = "Case #" ++ (show c) ++ ": " ++ s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment