結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー lllllll88938494lllllll88938494
提出日時 2023-05-06 11:14:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 134 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 136,448 KB
最終ジャッジ日時 2024-05-03 00:40:22
合計ジャッジ時間 3,068 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
136,320 KB
testcase_01 AC 141 ms
136,320 KB
testcase_02 AC 146 ms
136,064 KB
testcase_03 AC 140 ms
136,064 KB
testcase_04 AC 143 ms
136,064 KB
testcase_05 AC 141 ms
136,064 KB
testcase_06 AC 142 ms
136,000 KB
testcase_07 AC 108 ms
136,064 KB
testcase_08 AC 141 ms
136,320 KB
testcase_09 AC 142 ms
136,172 KB
testcase_10 AC 140 ms
136,448 KB
testcase_11 AC 140 ms
135,936 KB
testcase_12 AC 109 ms
136,320 KB
testcase_13 AC 141 ms
136,064 KB
testcase_14 AC 110 ms
136,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())

f=[0]*10**7
f[1] = 1

for i in range(2,10**7):
    f[i] = f[i-2] + f[i-1]
    f[i] %= m

print(f[n-1]%m)
0