結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
![]() |
提出日時 | 2018-11-22 20:29:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 391 bytes |
コンパイル時間 | 161 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 87,536 KB |
最終ジャッジ日時 | 2024-12-24 17:52:30 |
合計ジャッジ時間 | 20,923 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 4 TLE * 4 |
ソースコード
import numpy as np def calFibonatti(N): if N<=3: if N == 1: return 0 return 1 N = N - 3 A = np.zeros((2,2),dtype=int) A[0][0]=1 A[0][1]=1 A[1][0]=1 A[1][1]=0 result = np.copy(A) for i in range(N): result = result.dot(A) return result[0][0] N,M = map(int, input().split()) print(calFibonatti(N)%M)