-
Title Description:
-
Enter an n-dimensional matrix to determine whether it is symmetrical.
-
Input:
-
Enter the first line to include a number: N (1<=n<=100), which represents the dimension of the matrix.
The next n rows, each containing the n number, represent the elements of the n*n matrix.
-
Output:
-
There may be multiple sets of test data, for each set of data,
Output "yes!" Represents the matrix as a symmetric matrix.
Output "no!" Indicates that the matrix is not a symmetric matrix.
-
Sample input:
-
416 19 16 6 19 16 14 5 16 14 16 3 6 5 3 16 21 23 4
-
Sample output:
-
yes! No!
1 ImportJava.math.BigInteger;2 ImportJava.util.Scanner;3 4 Public classmain{5 Public Static voidMain (String[]args) {6Scanner in=NewScanner (system.in);7 while(In.hasnext ()) {8 intn=in.nextint ();9 int[][]ju=New int[n][n];Ten for(inti=0;i<n;i++){ One for(intj=0;j<n;j++){ Aju[i][j]=in.nextint (); - } - } the Booleanan=true; - for(inti=0;i<n;i++){ - for(intj=0;j<i;j++){ - if(ju[i][j]!=Ju[j][i]) + { -an=false; + Break; A } at } - if(an==false) Break; - } -System.out.println (an? ") Yes! ":" No! "); - } - } in } - to /************************************************************** + problem:1180 - user:0000h the Language:java * result:accepted $ time:630 MsPanax Notoginseng memory:95112 KB - ****************************************************************/
Topic 1180: Symmetric matrices