結果
| 問題 | No.657 テトラナッチ数列 Easy |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-09 16:43:15 |
| 言語 | Haskell (9.10.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 576 bytes |
| 記録 | |
| コンパイル時間 | 8,309 ms |
| コンパイル使用メモリ | 183,808 KB |
| 実行使用メモリ | 22,784 KB |
| 最終ジャッジ日時 | 2025-01-02 09:58:20 |
| 合計ジャッジ時間 | 19,751 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 TLE * 4 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.10.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Control.Monad as M
main :: IO ()
main = do
q <- readLn
putStr . unlines . map show . solves =<< M.replicateM q readLn
solves:: [Int] -> [Int]
solves = map solve
where
solve :: Int -> Int
solve 1 = 0
solve 2 = 0
solve 3 = 0
solve 4 = 1
solve n = solve' n 5 (0, 0, 0, 1)
solve' :: Int -> Int -> (Int, Int, Int, Int) -> Int
solve' n i (a, b, c, d)
| n == i = s
| otherwise = solve' n (i + 1) (b, c, d, s)
where
s = (a + b + c + d) `mod` 17