The phenomenon and background of the problem
Judge the upper triangular matrix
Problem related code , Do not paste screenshots
#include <stdio.h>int main(){ int i,j,m,a,b,ii,q,jj,ret,num; int pd[10]; int ch[10][10]; scanf("%d",&ii); for(jj=0;jj<ii;jj++) { num=1; scanf("%d",&m); for(i=0;i<m;i++) { for(j=0;j<m;j++) { scanf("%d",&ch[i][j]); } } if(m==1) { num=0; // This block is mainly used to judge that the matrix is 1 Special circumstances of , If 1, that num Namely 0, Output in later judgment no } ret=0; for(a=0;a<m;a++) { for(b=0;b<a;b++) { if(ch[a][b]!=0) ret++; } } if(ret==0&&num!=0) { pd[jj]=1; }else{ pd[jj]=0; }} int z; for(z=0;z<ii;z++) { if(pd[z]==1) { printf("YES\n"); }else{ printf("NO\n"); } } return 0;}
Results the correct , however oj I can't get through it
The results include the input matrix as 1 and 0
thank