2008-09-03から1日間の記事一覧
import Data.List countCycle n m stack | rem (n*10) m == 0 = 0 | otherwise = case findIndex (== rem (n*10) m) stack of Nothing -> let remainder = rem (n*10) m next = n*10 - (div (n*10) m)*m in countCycle next m (remainder:stack) Just x -> x…