結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー sekiya9311sekiya9311
提出日時 2017-06-09 22:32:00
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 143 bytes
コンパイル時間 803 ms
コンパイル使用メモリ 7,104 KB
実行使用メモリ 42,880 KB
最終ジャッジ日時 2023-10-23 21:54:26
合計ジャッジ時間 4,656 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,424 KB
testcase_01 AC 11 ms
6,412 KB
testcase_02 AC 12 ms
6,412 KB
testcase_03 AC 12 ms
6,412 KB
testcase_04 AC 11 ms
6,412 KB
testcase_05 AC 11 ms
6,412 KB
testcase_06 AC 11 ms
6,412 KB
testcase_07 AC 12 ms
6,412 KB
testcase_08 AC 15 ms
6,740 KB
testcase_09 AC 139 ms
9,656 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

prepre = 0
pre = 1

for i in range(n - 2):
  now = prepre + pre
  prepre = pre
  pre = now
print(pre % m)
0