結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー Taiki MaekawaTaiki Maekawa
提出日時 2021-02-19 16:02:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 158 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 10,564 KB
実行使用メモリ 33,848 KB
最終ジャッジ日時 2023-10-14 10:05:33
合計ジャッジ時間 8,055 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
33,740 KB
testcase_01 AC 125 ms
29,552 KB
testcase_02 AC 126 ms
29,400 KB
testcase_03 AC 127 ms
29,380 KB
testcase_04 AC 125 ms
29,472 KB
testcase_05 AC 125 ms
29,344 KB
testcase_06 AC 125 ms
29,432 KB
testcase_07 AC 127 ms
29,328 KB
testcase_08 AC 152 ms
29,384 KB
testcase_09 AC 370 ms
29,476 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N, M = map(int, input().split())

f = np.array([0, 1])
m = np.array([[1, 1], [1, 0]])
for _ in range(N):
    f = m.dot(f) % M
print(f[1])
0