a043: The Determinant 行列式求值
標籤 : Mathematics 數學
通過比率 : 100% (21 人 / 21 人 ) (非即時)
評分方式 :
Tolerant

最近更新 : 2019-04-09 08:53

內容

A determinant is defined as:

已知行列式運算為

 

a b c
d e f
g h i

= a * e * i + d * h * c + g * b * f - c * e * g - b * d * i - a * f * h

Calculate a determinant of 3x3 matrices.

求以下三階行列式的結果。

輸入說明

The first line of the input contains an integer N indicating the number of test cases (1 ≤ N ≤ 100). For each test case, there are three lines with three integer separated by one space.

 

第一行輸入一正整數N,表示共有N筆測試資料(1 ≤ N ≤ 100),每筆測試資料為一個行列式,行列式內容為 3 列,每一列有 3 個整數,用空白分開。

For example, a test case is following:

例如輸入內容為:

1 2 3

4 5 6

7 8 9

輸出說明

Output the answer of each test case. Add a “newline” in the end of the output.

輸出計算的答案,最後必須有換行字元。

例如輸出為:0

範例輸入
2
1 2 3 
4 5 6 
7 8 9
6 9 4
2 4 9
1 8 3
範例輸出
0
-285
測資資訊 :
記憶體限制 : 64 MB
隱藏 測資點#0 (50%): 1.0s , <1K
隱藏 測資點#1 (50%): 1.0s , <1K
提示 :
標籤:
Mathematics 數學
出處:
ITSA_50th [編輯 :
shengZJ (shengZJ)
]


編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」