題目列表
簡單 時間限制:3 s記憶體限制:128 MB

Online Judge - 11349 - Symmetric Matrix

來源代碼:UVa
前往提交 ↓

You‘re given a square matrix M. Elements of this matrix are M_{ij} : \{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:

M = \begin{bmatrix} 5 & 1 & 3 \\ 2 & 0 & 2 \\ 3 & 1 & 5 \end{bmatrix}

is symmetric

M = \begin{bmatrix} 5 & 1 & 3 \\ 2 & 0 & 2 \\ 0 & 1 & 5 \end{bmatrix}

is not symmetric, because 3 \ne 0

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} \le M_{ij} \le 2^{32} and 0 < n \le 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 M_{ij} of matrix you have to process.

輸出說明

For each test case output one line \text{‘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.

輸入輸出範例

範例 1

範例輸入
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.

範例 2

範例輸入
1
N = 1
0
範例輸出
Test #1: Symmetric.

範例 3

範例輸入
2
N = 2
4294967296 7
7 4294967296
N = 2
1 2
3 1
範例輸出
Test #1: Symmetric.
Test #2: Non-symmetric.

討論

登入後即可加入討論。 登入

目前還沒有討論文章。

最近提交

目前還沒有提交紀錄。

登入後即可撰寫程式、測試範例及提交解答。

登入