結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー MarioMario
提出日時 2018-06-03 13:31:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 153 bytes
コンパイル時間 1,266 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 114,776 KB
最終ジャッジ日時 2023-09-12 21:50:46
合計ジャッジ時間 3,649 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,180 KB
testcase_01 AC 73 ms
71,152 KB
testcase_02 AC 73 ms
71,332 KB
testcase_03 AC 73 ms
71,148 KB
testcase_04 AC 73 ms
71,092 KB
testcase_05 AC 72 ms
71,168 KB
testcase_06 AC 74 ms
71,248 KB
testcase_07 AC 73 ms
71,460 KB
testcase_08 AC 77 ms
75,308 KB
testcase_09 AC 80 ms
75,744 KB
testcase_10 AC 100 ms
83,352 KB
testcase_11 AC 185 ms
114,712 KB
testcase_12 AC 188 ms
114,636 KB
testcase_13 AC 183 ms
114,592 KB
testcase_14 AC 186 ms
114,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def fib(n, m):
    a, b = 1, 0
    for _ in [0] * (n - 2):
        a, b = (a + b) % m, a
    return a

n, m = map(int, input().split())
print(fib(n, m))
0