2010-12-31から1日間の記事一覧
硬貨の種類を順に増やすというボトムアップを行うシンプルなもの. module CountChange where type Amount = Int type Coins = [Int] jpy :: Coins jpy = [1,5,10,50,100,500,1000,2000,5000,10000] cc :: Coins -> Amount -> Integer cc cs a = foldl f (1:…
硬貨の種類を順に増やすというボトムアップを行うシンプルなもの. module CountChange where type Amount = Int type Coins = [Int] jpy :: Coins jpy = [1,5,10,50,100,500,1000,2000,5000,10000] cc :: Coins -> Amount -> Integer cc cs a = foldl f (1:…