結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-12-19 12:11:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,748 ms / 2,000 ms
コード長 112 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 11,732 KB
実行使用メモリ 206,008 KB
最終ジャッジ日時 2023-10-21 09:07:40
合計ジャッジ時間 7,668 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,076 KB
testcase_01 AC 27 ms
10,076 KB
testcase_02 AC 24 ms
10,076 KB
testcase_03 AC 23 ms
10,076 KB
testcase_04 AC 25 ms
10,076 KB
testcase_05 AC 25 ms
10,076 KB
testcase_06 AC 23 ms
10,076 KB
testcase_07 AC 26 ms
10,104 KB
testcase_08 AC 27 ms
10,468 KB
testcase_09 AC 56 ms
13,988 KB
testcase_10 AC 304 ms
49,208 KB
testcase_11 AC 1,665 ms
206,008 KB
testcase_12 AC 1,093 ms
50,292 KB
testcase_13 AC 1,748 ms
206,008 KB
testcase_14 AC 1,597 ms
206,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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