結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー lloyzlloyz
提出日時 2022-10-16 13:55:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 148 bytes
コンパイル時間 1,193 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 115,256 KB
最終ジャッジ日時 2023-09-09 17:06:49
合計ジャッジ時間 2,674 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,364 KB
testcase_01 AC 72 ms
71,044 KB
testcase_02 AC 72 ms
71,484 KB
testcase_03 AC 72 ms
71,412 KB
testcase_04 AC 71 ms
71,440 KB
testcase_05 AC 72 ms
71,472 KB
testcase_06 AC 73 ms
71,336 KB
testcase_07 AC 72 ms
71,488 KB
testcase_08 AC 76 ms
76,324 KB
testcase_09 AC 78 ms
76,824 KB
testcase_10 AC 89 ms
83,912 KB
testcase_11 AC 136 ms
115,156 KB
testcase_12 AC 120 ms
115,136 KB
testcase_13 AC 136 ms
115,256 KB
testcase_14 AC 121 ms
114,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
F = [0 for _ in range(n)]
F[1] = 1
for i in range(2, n):
    F[i] = F[i - 1] + F[i - 2]
    F[i] %= m
print(F[-1])
0