結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
![]() |
提出日時 | 2021-10-22 23:38:42 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 197 bytes |
コンパイル時間 | 367 ms |
コンパイル使用メモリ | 82,296 KB |
実行使用メモリ | 66,936 KB |
最終ジャッジ日時 | 2024-09-24 06:27:28 |
合計ジャッジ時間 | 1,786 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 12 |
ソースコード
import numpy as np N, M = map(int, input().split()) mat = np.matrix([[1, 1], [1, 0]]) fib = np.matrix([[0], [1]]) mat_N = np.linalg.matrix_power(mat, N) ans = np.dot(mat_N, fib) print(ans[1, 0]%M)