結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー HaarHaar
提出日時 2018-09-26 09:46:09
言語 Haskell
(9.6.2)
結果
TLE  
実行時間 -
コード長 225 bytes
コンパイル時間 961 ms
コンパイル使用メモリ 159,104 KB
実行使用メモリ 729,808 KB
最終ジャッジ日時 2023-07-30 15:33:04
合計ジャッジ時間 11,849 ms
ジャッジサーバーID
(参考情報)
judge5 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,128 KB
testcase_01 AC 2 ms
7,116 KB
testcase_02 AC 2 ms
7,124 KB
testcase_03 AC 3 ms
7,108 KB
testcase_04 AC 2 ms
7,092 KB
testcase_05 AC 2 ms
7,148 KB
testcase_06 AC 2 ms
7,196 KB
testcase_07 AC 3 ms
7,328 KB
testcase_08 AC 5 ms
9,536 KB
testcase_09 AC 33 ms
22,832 KB
testcase_10 AC 414 ms
138,100 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 MLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

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