結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー mitsuomitsuo
提出日時 2017-06-20 12:12:24
言語 Python2
(2.7.18)
結果
MLE  
実行時間 -
コード長 315 bytes
コンパイル時間 43 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 815,120 KB
最終ジャッジ日時 2024-04-10 02:45:44
合計ジャッジ時間 2,457 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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



def rev(k):
    cache = [0, 1]
    for w in range(k):
        cache.append(cache[w] + cache[w + 1])
    return cache[k - 1]


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

if __name__ == "__main__":
    print solve(raw_input())
0