油売り算(1)
30分プログラム、その708。昔の日記をあさっていたら、http://karetta.jp/article/blog/ll-spirit/033840が解けてなかったので、再チェレンジ!
が、前回挫折しただけあって、なかなか難しい。とりあえず、後で必要になるだろう型を定義しました。続きはまた今度。
ソースコード
import Text.Printf import Data.List import Control.Monad.List data Pot = Pot { name :: String, capacity :: Int, volume :: Int } deriving Show newtype Step = Step (String,String,Int) instance Show Step where show (Step (from,to,n)) = printf "%s --> %s (%d)" from to n