結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー kohei2019kohei2019
提出日時 2022-02-06 17:25:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 389 ms / 2,000 ms
コード長 109 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 86,696 KB
実行使用メモリ 254,036 KB
最終ジャッジ日時 2023-09-02 07:02:25
合計ジャッジ時間 3,881 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,084 KB
testcase_01 AC 80 ms
71,036 KB
testcase_02 AC 74 ms
71,076 KB
testcase_03 AC 78 ms
71,136 KB
testcase_04 AC 72 ms
70,864 KB
testcase_05 AC 73 ms
71,176 KB
testcase_06 AC 75 ms
71,036 KB
testcase_07 AC 75 ms
71,236 KB
testcase_08 AC 92 ms
75,784 KB
testcase_09 AC 85 ms
82,224 KB
testcase_10 AC 130 ms
152,344 KB
testcase_11 AC 348 ms
253,784 KB
testcase_12 AC 389 ms
254,036 KB
testcase_13 AC 279 ms
253,988 KB
testcase_14 AC 274 ms
253,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
ll = [0,1]
for i in range(N):
    ll.append((ll[-1]+ll[-2])%M)

print(ll[N-1])
0