結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー S6136OS6136O
提出日時 2017-09-21 22:09:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 160 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,552 KB
最終ジャッジ日時 2024-04-26 06:43:39
合計ジャッジ時間 8,525 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 487 ms
44,156 KB
testcase_01 AC 487 ms
44,172 KB
testcase_02 AC 474 ms
43,900 KB
testcase_03 AC 509 ms
43,908 KB
testcase_04 AC 493 ms
44,428 KB
testcase_05 AC 495 ms
44,304 KB
testcase_06 WA -
testcase_07 AC 489 ms
44,148 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 482 ms
43,912 KB
testcase_13 WA -
testcase_14 AC 483 ms
44,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def fib_matpow(p, r):
    q = numpy.matrix('1 1 ; 1 0') ** p
    return q % r

print(fib_matpow(n, m).item(1, 1))
0