結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー zundamo-tizundamo-ti
提出日時 2020-10-23 12:16:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 143 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 114,984 KB
最終ジャッジ日時 2023-09-28 15:19:51
合計ジャッジ時間 2,575 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,264 KB
testcase_01 AC 75 ms
71,256 KB
testcase_02 AC 76 ms
71,200 KB
testcase_03 AC 75 ms
71,244 KB
testcase_04 AC 74 ms
71,204 KB
testcase_05 AC 75 ms
71,356 KB
testcase_06 AC 76 ms
71,376 KB
testcase_07 AC 76 ms
71,268 KB
testcase_08 AC 78 ms
75,840 KB
testcase_09 AC 81 ms
76,572 KB
testcase_10 AC 91 ms
83,820 KB
testcase_11 AC 132 ms
114,984 KB
testcase_12 AC 111 ms
114,812 KB
testcase_13 AC 127 ms
114,756 KB
testcase_14 AC 115 ms
114,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())

F = [1]*(N + 1)
F[1] = 0
for n in range(3, N + 1):
    F[n] = F[n - 1] + F[n - 2]
    F[n] %= M

print(F[N])
0