結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー Akisawa3Akisawa3
提出日時 2023-04-22 20:50:02
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 279 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 87,040 KB
最終ジャッジ日時 2024-04-24 23:10:12
合計ジャッジ時間 4,701 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
57,216 KB
testcase_01 AC 52 ms
65,024 KB
testcase_02 AC 219 ms
75,136 KB
testcase_03 AC 42 ms
52,096 KB
testcase_04 AC 493 ms
75,648 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(10**9)
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')

N, M = map(int, input().split())
def Fib(n):    
    if n == 1:
        return 0
    elif n == 2:
        return 1
    else:
        return Fib(n-1) + Fib(n-2)

print(Fib(N) % M)
0