Topic 1180: Symmetric matrices

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.