上三角矩阵

上三角矩阵判定

http://www.nowcoder.com/questionTerminal/f5a29bacfc514e5a935723857e1245e4

import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int i = 0; i < n; ++i){
            for(int j = 0; j < n; ++j){
                if(sc.nextInt() != 0 && j < i){
                    System.out.println("NO");
                    return;
                }
            }
        }
        System.out.println("YES");
    }
}
全部评论

相关推荐

不愿透露姓名的神秘牛友
06-26 15:18
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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