結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー wesoweeenwesoweeen
提出日時 2022-02-02 21:18:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 285 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 12,780 KB
最終ジャッジ日時 2023-09-02 02:59:38
合計ジャッジ時間 4,126 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,904 KB
testcase_01 AC 16 ms
7,908 KB
testcase_02 AC 138 ms
7,912 KB
testcase_03 AC 15 ms
7,848 KB
testcase_04 AC 325 ms
7,776 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(1500)

def fibonacci(n) -> int:
    if n == 0 or n == 1:
        return n
    return fibonacci(n - 1) + fibonacci(n - 2)


def main() -> None:
    N, M = map(int, input().split())
    print(fibonacci(N - 1) % M)


if __name__ == "__main__":
    main()
0