結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー HaarHaar
提出日時 2018-09-26 09:46:09
言語 Haskell
(9.8.2)
結果
MLE  
実行時間 -
コード長 225 bytes
コンパイル時間 2,435 ms
コンパイル使用メモリ 172,800 KB
実行使用メモリ 726,400 KB
最終ジャッジ日時 2024-04-17 16:38:33
合計ジャッジ時間 8,188 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 3 ms
6,272 KB
testcase_09 AC 27 ms
20,224 KB
testcase_10 AC 430 ms
135,424 KB
testcase_11 MLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 MLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Data.Int
import Data.Array

main = do
  [n,m] <- map read . words <$> getLine :: IO [Int64]
  let fib = array (1,n) $ (1,0) : (2,1) : [(i,(fib!(i-1)+fib!(i-2))`mod`m) | i<-[3..n]] :: Array Int64 Int64
  print $ fib!n

0