結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー salmon0852salmon0852
提出日時 2021-12-25 14:49:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 137 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 11,788 KB
実行使用メモリ 205,908 KB
最終ジャッジ日時 2023-10-21 15:56:44
合計ジャッジ時間 9,790 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,060 KB
testcase_01 AC 30 ms
10,060 KB
testcase_02 AC 30 ms
10,060 KB
testcase_03 AC 28 ms
10,060 KB
testcase_04 AC 29 ms
10,060 KB
testcase_05 AC 28 ms
10,060 KB
testcase_06 AC 28 ms
10,060 KB
testcase_07 AC 29 ms
10,084 KB
testcase_08 AC 32 ms
10,492 KB
testcase_09 AC 68 ms
13,716 KB
testcase_10 AC 399 ms
48,996 KB
testcase_11 TLE -
testcase_12 AC 1,634 ms
87,936 KB
testcase_13 TLE -
testcase_14 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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