結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 490 ms
44,300 KB
testcase_01 AC 482 ms
43,896 KB
testcase_02 AC 492 ms
43,888 KB
testcase_03 AC 479 ms
43,916 KB
testcase_04 AC 495 ms
44,160 KB
testcase_05 AC 485 ms
43,896 KB
testcase_06 WA -
testcase_07 AC 491 ms
44,044 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 497 ms
44,284 KB
testcase_13 WA -
testcase_14 AC 502 ms
44,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

print(fib_matpow(n)%m)
0