結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー kutaragi36kutaragi36
提出日時 2023-05-28 04:42:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 153 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 86,628 KB
実行使用メモリ 114,832 KB
最終ジャッジ日時 2023-08-27 03:45:04
合計ジャッジ時間 3,212 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
114,532 KB
testcase_01 AC 119 ms
114,360 KB
testcase_02 AC 117 ms
114,160 KB
testcase_03 AC 115 ms
114,644 KB
testcase_04 AC 117 ms
114,832 KB
testcase_05 AC 117 ms
114,540 KB
testcase_06 AC 115 ms
114,468 KB
testcase_07 AC 103 ms
114,264 KB
testcase_08 AC 116 ms
114,460 KB
testcase_09 AC 117 ms
114,620 KB
testcase_10 AC 115 ms
114,320 KB
testcase_11 AC 118 ms
114,596 KB
testcase_12 AC 102 ms
114,200 KB
testcase_13 AC 116 ms
114,404 KB
testcase_14 AC 102 ms
114,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, MOD = map(int, input().split())
Z = 5*10**6

F = [0] * (Z+1)
F[1] = 0
F[2] = 1
for i in range(3, Z+1):
    F[i] = (F[i-1] + F[i-2]) % MOD

print(F[N])
0