You are viewing a single comment's thread. Return to all comments →
Haskell
module Main where import Control.Monad (replicateM_) import qualified Data.Set as S fibos :: S.Set Integer fibos = S.fromList $ takeWhile (<= 10000000000) fibos' where fibos' = 1 : 1 : zipWith (+) fibos' (tail fibos') main :: IO () main = do cases <- readLn :: IO Int replicateM_ cases $ do n <- readLn :: IO Integer putStrLn $ if n `S.member` fibos then "IsFibo" else "IsNotFibo"
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Is Fibo
You are viewing a single comment's thread. Return to all comments →
Haskell