• + 0 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"