結果

問題 No.657 テトラナッチ数列 Easy
ユーザー CreativeGP1
提出日時 2018-03-06 15:10:23
言語 Haskell
(9.10.1)
結果
TLE  
実行時間 -
コード長 427 bytes
コンパイル時間 7,876 ms
コンパイル使用メモリ 174,852 KB
実行使用メモリ 73,756 KB
最終ジャッジ日時 2024-09-18 23:37:17
合計ジャッジ時間 10,672 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 4 TLE * 1 -- * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative

string2int str = read str :: Int

mtetra = (map tetra [0 ..] !!)
  where tetra 1 = 0
        tetra 2 = 0
        tetra 3 = 0
        tetra 4 = 1
        tetra n = mtetra (n-1) + mtetra (n-2) + mtetra (n-3) + mtetra (n-4)

ans n = do
  ss <- getLine
  let n = string2int ss
  print $ mod (mtetra n) 17

main :: IO ()
main = do
  ss <- getLine
  let q = string2int ss
  mapM_ ans $ enumFromTo 0 (q-1)
0