結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー zundamo-tizundamo-ti
提出日時 2020-10-23 12:16:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 143 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 10,620 KB
実行使用メモリ 203,988 KB
最終ジャッジ日時 2023-09-28 15:19:48
合計ジャッジ時間 11,844 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,876 KB
testcase_01 AC 16 ms
7,832 KB
testcase_02 AC 15 ms
7,856 KB
testcase_03 AC 16 ms
7,884 KB
testcase_04 AC 16 ms
7,924 KB
testcase_05 AC 15 ms
7,920 KB
testcase_06 AC 16 ms
7,848 KB
testcase_07 AC 16 ms
7,876 KB
testcase_08 AC 20 ms
8,196 KB
testcase_09 AC 62 ms
11,936 KB
testcase_10 AC 459 ms
47,024 KB
testcase_11 TLE -
testcase_12 AC 1,889 ms
46,844 KB
testcase_13 TLE -
testcase_14 TLE -
権限があれば一括ダウンロードができます

ソースコード

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