题解 | #KiKi判断上三角矩阵#
KiKi判断上三角矩阵
https://www.nowcoder.com/practice/9a6786c28cdb45f9b991685f867b5d08
#include <stdio.h> int main() { int num = 0; while (scanf("%d", &num) != EOF) { int arr[10][10] = {0}; for (int i = 0; i <num;i++) { for (int j = 0; j < num; j++) { scanf("%d",arr[i] + j); } } int flag = 0; for (int i = 1; i < num; i++) { for (int j = 0; j < i; j++) { if (arr[i][j] != 0) { flag++; } } } if (flag) { printf("NO"); } else { printf("YES"); } } return 0; }