結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー MarioMario
提出日時 2018-06-03 13:31:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 706 ms / 2,000 ms
コード長 153 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 10,648 KB
実行使用メモリ 47,012 KB
最終ジャッジ日時 2023-09-12 21:50:12
合計ジャッジ時間 3,518 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,748 KB
testcase_01 AC 15 ms
7,928 KB
testcase_02 AC 15 ms
7,940 KB
testcase_03 AC 15 ms
7,840 KB
testcase_04 AC 16 ms
7,748 KB
testcase_05 AC 15 ms
7,820 KB
testcase_06 AC 15 ms
7,776 KB
testcase_07 AC 16 ms
7,764 KB
testcase_08 AC 16 ms
7,756 KB
testcase_09 AC 25 ms
8,716 KB
testcase_10 AC 87 ms
15,736 KB
testcase_11 AC 613 ms
46,816 KB
testcase_12 AC 255 ms
46,960 KB
testcase_13 AC 706 ms
47,012 KB
testcase_14 AC 560 ms
46,980 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