結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー Luoto-green
提出日時 2017-07-31 08:43:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 193 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 49,880 KB
最終ジャッジ日時 2024-10-10 23:57:28
合計ジャッジ時間 4,224 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 1 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

def fi(n,m):
    f0 = 0
    f1 = 1
    f2 = (f0+f1)%m
    for i in [None]*n:
        f0 = f1
        f1 = f2
        f2 = (f0 + f1)%m
    return f2
n,m = map(int,input().split())
print(fi(n,m))
0