結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー ああいいああいい
提出日時 2022-03-08 14:52:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 150 bytes
コンパイル時間 836 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 114,604 KB
最終ジャッジ日時 2023-09-30 20:47:12
合計ジャッジ時間 2,702 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
70,888 KB
testcase_01 AC 71 ms
71,012 KB
testcase_02 AC 72 ms
70,696 KB
testcase_03 AC 71 ms
70,876 KB
testcase_04 AC 72 ms
71,004 KB
testcase_05 AC 71 ms
71,000 KB
testcase_06 AC 69 ms
71,316 KB
testcase_07 AC 71 ms
71,108 KB
testcase_08 AC 73 ms
75,548 KB
testcase_09 AC 75 ms
76,192 KB
testcase_10 AC 85 ms
83,224 KB
testcase_11 AC 118 ms
114,452 KB
testcase_12 AC 106 ms
114,436 KB
testcase_13 AC 117 ms
114,604 KB
testcase_14 AC 110 ms
114,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())

dat = [0] * (N + 1)
dat[1] = 0
dat[2] = 1
for i in range(3,N+1):
    dat[i] = (dat[i-1] + dat[i-2]) % M
print(dat[-1])
0