結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー 平間直道平間直道
提出日時 2024-01-17 22:36:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 251 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 88,736 KB
最終ジャッジ日時 2024-01-17 22:37:03
合計ジャッジ時間 4,861 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
60,264 KB
testcase_01 AC 55 ms
67,956 KB
testcase_02 AC 76 ms
74,940 KB
testcase_03 AC 35 ms
53,460 KB
testcase_04 AC 133 ms
75,312 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**6)

def fib(n,mod):
    if n==1:
        return 0
    elif n==2:
        return 1
    else:
        a=fib(n-1,mod)+fib(n-2,mod)
        a%=mod
        return a

n,m=map(int,input().split())
ans=fib(n,m)

print(ans)
0