結果

問題 No.2447 行列累乗根
ユーザー hitonanodehitonanode
提出日時 2023-08-25 22:12:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 487 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 51,252 KB
最終ジャッジ日時 2024-06-06 16:43:05
合計ジャッジ時間 17,676 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 489 ms
51,252 KB
testcase_01 AC 486 ms
44,980 KB
testcase_02 AC 493 ms
45,652 KB
testcase_03 AC 483 ms
45,596 KB
testcase_04 WA -
testcase_05 AC 499 ms
45,372 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 485 ms
45,240 KB
testcase_10 AC 489 ms
44,980 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 486 ms
45,236 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

def cb(a):
    if a >= 0:
        return pow(a, 1 / 3)
    else:
        return -pow(-a, 1 / 3)

T = int(input())


for _ in range(T):
    a, b = map(float, input().split())
    c, d = map(float, input().split())
    A = np.array([[a, b], [c, d]])

    eigval, eigvec = np.linalg.eig(A)
    M = np.array([[eigvec[0][0], eigvec[1][0]], [eigvec[0][1], eigvec[1][1]]])

    e0 = cb(eigval[0])
    e1 = cb(eigval[1])

    B = np.linalg.inv(M) * np.diag([e0, e1]) * M
    print("{:1.5f}".format(B[0][0]), "{:1.5f}".format(B[0][1]))
    print("{:1.5f}".format(B[1][0]), "{:1.5f}".format(B[1][1]))
0