結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー | aru_creator |
提出日時 | 2018-11-22 20:32:18 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 396 bytes |
コンパイル時間 | 79 ms |
コンパイル使用メモリ | 10,696 KB |
実行使用メモリ | 33,988 KB |
最終ジャッジ日時 | 2023-08-26 04:00:12 |
合計ジャッジ時間 | 6,049 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 113 ms
33,988 KB |
testcase_01 | AC | 111 ms
29,640 KB |
testcase_02 | AC | 112 ms
29,548 KB |
testcase_03 | AC | 116 ms
29,676 KB |
testcase_04 | AC | 123 ms
29,528 KB |
testcase_05 | AC | 121 ms
29,644 KB |
testcase_06 | WA | - |
testcase_07 | AC | 116 ms
29,500 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
ソースコード
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='int32') 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)