• + 0 comments

    memoized_fib :: Int -> Integer memoized_fib = (map fib [0 ..] !!) where fib 0 = 0 fib 1 = 1 fib n = memoized_fib (n-2) + memoized_fib (n-1)

    mymod :: Integer -> Integer mymod x = mod x ((10^8) + 7)

    atoi :: String -> Int atoi = read

    main = interact $ unlines . map (show. mymod) . map memoized_fib . map atoi . tail .lines