結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2020-08-02 07:45:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 544 ms / 2,000 ms
コード長 117 bytes
コンパイル時間 1,402 ms
コンパイル使用メモリ 86,784 KB
実行使用メモリ 76,536 KB
最終ジャッジ日時 2023-09-25 05:44:01
合計ジャッジ時間 4,582 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
70,992 KB
testcase_01 AC 70 ms
71,124 KB
testcase_02 AC 69 ms
71,100 KB
testcase_03 AC 69 ms
71,248 KB
testcase_04 AC 72 ms
71,296 KB
testcase_05 AC 70 ms
71,328 KB
testcase_06 AC 67 ms
71,324 KB
testcase_07 AC 87 ms
74,936 KB
testcase_08 AC 86 ms
76,064 KB
testcase_09 AC 91 ms
76,536 KB
testcase_10 AC 174 ms
76,512 KB
testcase_11 AC 518 ms
76,524 KB
testcase_12 AC 544 ms
76,332 KB
testcase_13 AC 525 ms
76,428 KB
testcase_14 AC 509 ms
76,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
f = [0, 1]

for i in range(n - 2):
    f[i % 2] = sum(f) % m

print(f[(n + 1) % 2])
0