题解 | #KiKi判断上三角矩阵#
KiKi判断上三角矩阵
https://www.nowcoder.com/practice/9a6786c28cdb45f9b991685f867b5d08
#include <iostream> using namespace std; int main() { int a[10][10], c; cin >> c; for (int i = 0; i < c; i++) { for (int j = 0; j < c; j++) { cin >> a[i][j]; } } for (int i = 0; i < c; i++) { for (int j = i - 1; j >= 0; j--) { if (i == c - 1 && j == 0 && a[i][j] == 0) cout << "YES"; else if (a[i][j] != 0) { cout << "NO"; return 0; } } } }