You‘re given a square matrix M. Elements of this matrix are Mij : {0 < i < n, 0 < j < n}. In this problem you’ll have to find out whether the given matrix is symmetric or not.
Definition: Symmetric matrix is such a matrix that all elements of it are non-negative and symmetric
with relation to the center of this matrix. Any other matrix is considered to be non-symmetric. For example:
All you have to do is to find whether the matrix is symmetric or not. Elements of a matrix given in the input are −2^32 ≤ Mij ≤ 2^32 and 0 < n ≤ 100.
中文:
現在給你一個正方形矩陣M。
M矩陣的元素為Mij:{0 < i < n,0 < j < n}。
在這個問題中,您必須找出給定的矩陣是否對稱(symmetric)。
定義:對稱矩陣所有元素都是非負的並且相對於該矩陣的中心對稱。
任何其他矩陣都被認為是非對稱的。譬如:
你要做的就是判斷這個矩陣是否對稱。
矩陣內的元素範圍為-2^32 <= Mij <= 2^32 且 0 < n <= 100。
First line of input contains number of test cases T ≤ 300. Then T test cases follow each described in the following way. The first line of each test case contains n – the dimension of square matrix. Then n lines follow each of then containing row i. Row contains exactly n elements separated by a space character. j-th number in row i is the element Mij of matrix you have to process.
中文:
輸入的第一行包含一個數字T (T <= 300),代表測資的數量。
每組測試資料的第一行包含兩個字元一個整數n,n代表這個正方矩陣的維度。
接下來的n行即為這個矩陣內的元素數值。
每一列i有n個數字,第i列的第j個數字即是Mij。
For each test case output one line ‘Test #t: S’. Where t is the test number starting from 1. Line S is equal to ‘Symmetric’ if matrix is symmetric and ‘Non-symmetric’ in any other case.
中文:
對每一筆測試資料輸出一行"Test #t: S",t為第幾筆測試資料的編號,S為答案字串。
如果輸入的矩陣是對稱矩陣,S = "Symmetric"。
如果輸入的矩陣不是對稱矩陣,S = "Non-symmetric"。
2 N = 3 5 1 3 2 0 2 3 1 5 N = 3 5 1 3 2 0 2 0 1 5
Test #1: Symmetric. Test #2: Non-symmetric.
編號 | 身分 | 題目 | 主題 | 人氣 | 發表日期 |
沒有發現任何「解題報告」 |