結果

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

ソースコード

diff #

def fi(n):
    f0 = 0
    f1 = 1
    if n == 0: return 0
    if n == 1 or n == 2: return 1
    while n > 2:
        f2 = f0 + f1
        f0 = f1
        f1 = f2
        n -=1
    return f2
n,m = map(int,input().split())
print(fi(n)%m)
0