結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2020-01-06 21:46:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 232 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-23 00:06:33
合計ジャッジ時間 10,165 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

input_list = list(map(int,input().split()))
n, m = input_list

front2 = 0 % m
front1 = 1 % m
cur = None

for i in range(3, n + 1):
    cur = front2 + front1
    front2 = front1 % m
    front1 = cur % m
    
res = cur % m

print(res)
0