作者:yunjinqi 类别:
日期:2023-05-31 17:22:59
阅读:462 次 消耗积分:0 分
#include <stdio.h>
int main(){
int T;
int n;
int matric[10][10];
int num;
if (scanf("%d",&T)!=EOF){
for (int i=0;i<T;i++){
if (scanf("%d",&n)!=EOF){
// 生成matric
for (int j=0;j<n;j++){
for (int l=0;l<n;l++){
if (scanf("%d",&num)!=0){
matric[j][l]=num;
}
}
}
//判断是否满足上三角矩阵
int count=0;
for (int j=0;j<n;j++){
for (int l=0;l<n;l++){
if (j>l){if (matric[j][l]!=0){count=1;}}
}
}
if (count==0){printf("YES\n");}
if (count!=0){printf("NO\n");}
}
}
}
else{
printf("input wrong");
}
return 0;
}