2009-01-31から1日間の記事一覧

JOI2008予選 問題1@Haskell

こんどはHaskellでやってみた。 solve :: Int -> [Int] -> Int -> Int solve price [] count = count solve price clist count | price >= (head clist) = solve (price - (head clist)) clist (count + 1) | otherwise = solve price (tail clist) count ma…

JOI2008予選 問題2@Haskell

countSubstringSub :: String -> String -> Int -> Int countSubstringSub _ [] count = count + 1 countSubstringSub [] _ count = count countSubstringSub str sub count | (head str) == (head sub) = countSubstringSub (tail str) (tail sub) count | …