結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー ydaigoydaigo
提出日時 2020-12-09 22:20:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 206 bytes
コンパイル時間 769 ms
コンパイル使用メモリ 81,396 KB
実行使用メモリ 137,588 KB
最終ジャッジ日時 2023-10-19 08:44:14
合計ジャッジ時間 2,808 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = [int(i) for  i in input().split()]
memo = [0]*(5*10**6-1)
def fib(n):
  if n<=1:
    return n
  if memo[n] != 0:
    return memo[n]
  memo[n] = fib(n-1) + fib(n-2)
  return memo[n]
print(fib(N[0])%N[1])
0