結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー | surprise_tanaka |
提出日時 | 2018-12-03 01:36:21 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 219 bytes |
コンパイル時間 | 95 ms |
コンパイル使用メモリ | 10,644 KB |
実行使用メモリ | 9,112 KB |
最終ジャッジ日時 | 2023-09-13 21:03:20 |
合計ジャッジ時間 | 1,511 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 20 ms
8,552 KB |
testcase_01 | AC | 20 ms
8,672 KB |
testcase_02 | AC | 19 ms
8,656 KB |
testcase_03 | AC | 20 ms
8,536 KB |
testcase_04 | AC | 19 ms
8,708 KB |
testcase_05 | AC | 20 ms
8,608 KB |
testcase_06 | AC | 19 ms
8,628 KB |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
ソースコード
from functools import lru_cache @lru_cache(maxsize = None) def fib(n): if n == 0: return 0 elif n == 1: return 1 return fib(n-1) + fib(n-2) N,M = map(int,input().split()) print(fib(N-1) % M)