結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー nohakai3nohakai3
提出日時 2022-08-02 11:24:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 127 bytes
コンパイル時間 1,458 ms
コンパイル使用メモリ 86,604 KB
実行使用メモリ 115,012 KB
最終ジャッジ日時 2023-09-30 10:08:54
合計ジャッジ時間 2,849 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
110,112 KB
testcase_01 AC 88 ms
110,280 KB
testcase_02 AC 86 ms
110,000 KB
testcase_03 AC 92 ms
110,272 KB
testcase_04 AC 85 ms
110,200 KB
testcase_05 AC 89 ms
109,952 KB
testcase_06 AC 93 ms
110,236 KB
testcase_07 AC 89 ms
109,952 KB
testcase_08 AC 95 ms
114,612 KB
testcase_09 AC 90 ms
114,824 KB
testcase_10 AC 97 ms
114,956 KB
testcase_11 AC 120 ms
115,012 KB
testcase_12 AC 108 ms
114,364 KB
testcase_13 AC 118 ms
114,900 KB
testcase_14 AC 109 ms
114,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


print(dp[n])
0