結果
問題 | No.891 隣接3項間の漸化式 |
ユーザー | aaaaaaaaaa2230 |
提出日時 | 2022-05-07 15:21:46 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 419 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 86,684 KB |
実行使用メモリ | 82,692 KB |
最終ジャッジ日時 | 2023-09-21 01:46:58 |
合計ジャッジ時間 | 6,147 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
75,632 KB |
testcase_01 | AC | 73 ms
71,336 KB |
testcase_02 | AC | 73 ms
71,236 KB |
testcase_03 | AC | 73 ms
71,244 KB |
testcase_04 | AC | 73 ms
71,392 KB |
testcase_05 | AC | 74 ms
71,364 KB |
testcase_06 | AC | 74 ms
71,248 KB |
testcase_07 | AC | 75 ms
71,408 KB |
testcase_08 | AC | 75 ms
71,248 KB |
testcase_09 | AC | 74 ms
71,356 KB |
testcase_10 | AC | 72 ms
71,412 KB |
testcase_11 | AC | 75 ms
71,036 KB |
testcase_12 | AC | 74 ms
71,240 KB |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
ソースコード
a,b,n = map(int,input().split()) mod = 10**9+7 def calc(x,y): ans = [[0]*2 for i in range(2)] for i in range(2): for j in range(2): for k in range(2): ans[i][j] += x[i][k]*y[k][j] ans[i][j] %= mod return ans A = [[a,b],[1,0]] base = [[1,0],[0,1]] n -= 1 while n: if n&1: base = calc(A,base) A = calc(A,A) n //= 2 print(base[0][0])