题解 | #KiKi判断上三角矩阵#

KiKi判断上三角矩阵

http://www.nowcoder.com/practice/9a6786c28cdb45f9b991685f867b5d08

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[][] array=new int[n][n];
        boolean flag=false;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<n;j++)
            {
                array[i][j]=sc.nextInt();
                if(i>j&&array[i][j]!=0)
                {
                    flag=true;
                }
            }
        }
        if(!flag)
        {
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-10 11:27
明天又是董事长面,啥时候是个头啊
在太阳里长大的人:公司就仨人吧😂
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务