--- title: 1C 三階矩陣行列值 tags: solution --- # C. 三階矩陣行列值 本題還不需要用到行列值降階的算法,所以基本上只需要用高中學過的三階行列值算法即可解。  ### Solution Code : > Time Complexity : $O(T)$ ```cpp= # include <iostream> using namespace std; int main(){ long long a[3][3]; long long result; int T,x,y; cin>>T; while(T--){ for(x = 0 ; x<3 ; x++) for(y = 0 ; y<3 ; y++) cin>>a[x][y]; result = a[0][0] * (a[1][1]*a[2][2] - a[2][1]*a[1][2]) + a[0][1] * (a[1][2]*a[2][0] - a[2][2]*a[1][0]) + a[0][2] * (a[1][0]*a[2][1] - a[2][0]*a[1][1]); cout<<result<<'\n'; } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up