Problem Description
Description
Write a program that inputs a positive integer n (1<=n<=10) and the elements of an n×n square matrix a. If a is an upper triangular matrix, output “YES”; otherwise, output “NO". An upper triangular matrix is a matrix in which all elements below the main diagonal (excluding the main diagonal) are 0. The main diagonal is the line from the upper-left corner to the lower-right corner of the matrix. It is required to define a function IsUpperTriMatrixO to determine whether matrix a is an upper triangular matrix; return 1 if it is, otherwise return 0. The function prototype is as follows: IsUpperTriMatrix(int a, int n);
Input
Input a positive integer n (1<=n<=10) and the elements of an n×n square matrix a; all are integers.
Output
If a is an upper triangular matrix, output “YES"; otherwise, output “NO”
Sample Input
| |
Sample Output
| |
Problem Analysis
The problem explains what an upper triangular matrix is. The judgment itself is not difficult.
| |
Problem address:[ZZULI] [1125] Upper Triangular Matrix Judgment