結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 494 ms
44,172 KB
testcase_01 AC 494 ms
43,908 KB
testcase_02 AC 493 ms
44,408 KB
testcase_03 AC 500 ms
44,300 KB
testcase_04 AC 492 ms
44,116 KB
testcase_05 AC 501 ms
44,152 KB
testcase_06 WA -
testcase_07 AC 504 ms
44,280 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 487 ms
43,912 KB
testcase_13 WA -
testcase_14 AC 504 ms
43,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy
n, m = map(int, input().split())
def fib_matpow(n):
        m = numpy.matrix('1 1 ; 1 0') ** (n-2)
        return m.item(0)

print(fib_matpow(n)%m)
0