結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー | lvs7k |
提出日時 | 2018-09-15 12:10:14 |
言語 | Haskell (9.8.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 352 bytes |
コンパイル時間 | 9,146 ms |
コンパイル使用メモリ | 161,588 KB |
実行使用メモリ | 212,568 KB |
最終ジャッジ日時 | 2023-09-23 03:37:11 |
合計ジャッジ時間 | 15,038 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,488 KB |
testcase_01 | AC | 3 ms
7,392 KB |
testcase_02 | AC | 3 ms
7,460 KB |
testcase_03 | AC | 3 ms
7,384 KB |
testcase_04 | AC | 3 ms
7,456 KB |
testcase_05 | AC | 3 ms
7,400 KB |
testcase_06 | WA | - |
testcase_07 | AC | 3 ms
7,784 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
module Main where import Control.Monad import qualified Data.IntMap.Lazy as M fibo :: Int -> Int fibo n = f n where memo = M.fromList $ fmap (\i -> (i, f i)) [1 .. n] f 1 = 0 f 2 = 1 f x = memo M.! (x - 2) + memo M.! (x - 1) main :: IO () main = do [n, m] <- fmap read . words <$> getLine :: IO [Int] print $ fibo n `mod` m