wvogel日記

自分用の技術備忘録が多めです.

PC甲子園

パソコン甲子園2010年度予選問題第四問を
Haskellで。
なんてことはないですね

ice = repeat ""

f :: [String] -> [Int] -> String
f ds [] = unlines $ map (\str -> if str == "" then "-" else str) ds
f ds (x:xs) = f recompose xs
  where
    recompose = take x ds ++ [ '*':ds!!x ] ++ drop (x+1) ds

main = do n <- getLine
          cs <- getContents
          putStrLn.f (take 10 ice) $ map read $ take (read n)$lines cs