結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー | ydaigo |
提出日時 | 2020-12-09 22:34:56 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 261 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 81,576 KB |
実行使用メモリ | 136,024 KB |
最終ジャッジ日時 | 2023-10-19 08:58:00 |
合計ジャッジ時間 | 2,493 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 55 ms
92,344 KB |
testcase_01 | AC | 53 ms
92,344 KB |
testcase_02 | AC | 52 ms
92,344 KB |
testcase_03 | AC | 52 ms
92,344 KB |
testcase_04 | AC | 55 ms
92,344 KB |
testcase_05 | AC | 51 ms
92,344 KB |
testcase_06 | AC | 105 ms
131,448 KB |
testcase_07 | AC | 111 ms
136,024 KB |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
ソースコード
N = [int(i) for i in input().split()] """メモ化フィボナッチ""" memo = [0]*5*10**6 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]-1)%N[1])