結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー caleicalei
提出日時 2020-01-28 23:37:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 223 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 76,124 KB
最終ジャッジ日時 2023-10-13 20:59:11
合計ジャッジ時間 2,556 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,212 KB
testcase_01 AC 74 ms
71,392 KB
testcase_02 AC 72 ms
71,376 KB
testcase_03 AC 74 ms
71,256 KB
testcase_04 AC 72 ms
71,456 KB
testcase_05 AC 75 ms
71,340 KB
testcase_06 AC 74 ms
71,056 KB
testcase_07 AC 74 ms
71,368 KB
testcase_08 AC 77 ms
76,124 KB
testcase_09 AC 77 ms
75,864 KB
testcase_10 AC 82 ms
76,024 KB
testcase_11 AC 104 ms
75,888 KB
testcase_12 AC 90 ms
75,564 KB
testcase_13 AC 103 ms
75,692 KB
testcase_14 AC 89 ms
75,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# yukicoder No.526 フィボナッチ数列の第N項をMで割った余りを求める 2020/01/28

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

fib=[0,1]
for i in range(n-2):
    fib[1],fib[0]=(fib[0]+fib[1])%m,(fib[1])%m
print(fib[1]%m)
0