mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-23 15:48:42 +00:00
36 lines
613 B
C
36 lines
613 B
C
|
#include <stdio.h>
|
||
|
|
||
|
int t, n, mat[15][15];
|
||
|
|
||
|
int main() {
|
||
|
scanf("%d", &t);
|
||
|
|
||
|
while (t--) {
|
||
|
scanf("%d", &n);
|
||
|
|
||
|
for (int i = 1; i <= n; i++) {
|
||
|
for (int j = 1; j <= n; j++) {
|
||
|
scanf("%d", &mat[i][j]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int flag = 1;
|
||
|
|
||
|
for (int i = 1; i <= n; i++) {
|
||
|
for (int j = 1; j < i; j++) {
|
||
|
if (mat[i][j] != 0) {
|
||
|
flag = 0;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (flag) {
|
||
|
printf("YES\n");
|
||
|
} else {
|
||
|
printf("NO\n");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|