結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー ddsyg1ddsyg1
提出日時 2019-02-05 16:45:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 752 ms / 2,000 ms
コード長 147 bytes
コンパイル時間 957 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 7,980 KB
最終ジャッジ日時 2023-08-30 23:52:20
合計ジャッジ時間 3,533 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,976 KB
testcase_01 AC 14 ms
7,792 KB
testcase_02 AC 15 ms
7,784 KB
testcase_03 AC 15 ms
7,780 KB
testcase_04 AC 14 ms
7,888 KB
testcase_05 AC 15 ms
7,980 KB
testcase_06 AC 15 ms
7,824 KB
testcase_07 AC 14 ms
7,848 KB
testcase_08 AC 16 ms
7,796 KB
testcase_09 AC 24 ms
7,840 KB
testcase_10 AC 93 ms
7,896 KB
testcase_11 AC 662 ms
7,848 KB
testcase_12 AC 293 ms
7,884 KB
testcase_13 AC 752 ms
7,876 KB
testcase_14 AC 609 ms
7,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def fi(n, m):
    a, b = 1, 0
    for _ in range(n-2):
        a, b = (a + b) % m, a
    return a

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