You are viewing a single comment's thread. Return to all comments →
Haskell
module Main where solve p d m s = let seqH = takeWhile (>= m) $ iterate (subtract d) p seqT = repeat m sums = scanl1 (+) $ seqH ++ seqT in length $ takeWhile (<= s) sums main :: IO () main = do [p, d, m, s] <- fmap (map read . words) getLine print $ solve p d m s
Seems like cookies are disabled on this browser, please enable them to open this website
Halloween Sale
You are viewing a single comment's thread. Return to all comments →
Haskell