結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー sekiya9311
提出日時 2017-06-09 22:32:00
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 143 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 45,256 KB
最終ジャッジ日時 2024-09-22 15:17:46
合計ジャッジ時間 3,885 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 TLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

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