結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
コンテスト
ユーザー mitsuo
提出日時 2017-06-20 12:25:59
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
AC  
実行時間 578 ms / 2,000 ms
+ 871µs
コード長 378 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 913 ms
コンパイル使用メモリ 80,384 KB
実行使用メモリ 83,200 KB
最終ジャッジ日時 2026-07-18 14:53:57
合計ジャッジ時間 5,151 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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



def fab(k, m):
    cache = [0, 1]
    for w in range(k - 1):
        cache.append(cache[0] + cache[1])
        cache = map(lambda x: x % m, cache)
        del cache[0]

    return cache[0]


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

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