結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー mitsuomitsuo
提出日時 2017-06-20 11:33:32
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 323 bytes
コンパイル時間 776 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 13,752 KB
最終ジャッジ日時 2024-04-10 02:17:32
合計ジャッジ時間 5,215 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
13,752 KB
testcase_01 AC 13 ms
6,944 KB
testcase_02 AC 248 ms
6,944 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 631 ms
6,944 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-



def fab(k):
    if k < 1:
        return 0
    elif k == 1 :
        return 0
    elif k == 2:
        return  1
    else:
        return fab(k - 1) + fab(k -2)



def solve(input):
    n = int(input.split(" ")[0])
    m = int(input.split(" ")[1])
    return fab(n) % m


print solve(raw_input())
0