题解 | #上三角矩阵判定#

上三角矩阵判定

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

import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[][] array = new String[n][n];
        for (int i = 0; i < n; i++) {
            String[] arr = br.readLine().split(" ");
            for (int j = 0; j < n; j++) {
                array[i][j] = arr[j];
            }
        }
        System.out.println(judge(array, n));
    }
    
    public static String judge(String[][] arr, int row) {
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < i; j++) {
                if (Integer.parseInt(arr[i][j]) != 0) {
                    return "NO";
                }
            }
        }
        return "YES";
    }
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-08 10:39
一个证都没&nbsp;我能填什么
程序员小白条:别人有,你为什么没有,还是这个道理,社会就是比较,竞争,淘汰,你要安逸,那么就要做好淘汰的准备
点赞 评论 收藏
分享
Lorn的意义:你这种岗位在中国现在要么牛马天天加班,要么关系户进去好吃好喝,8年时间,真的天翻地覆了,对于资本来说你就说一头体力更好的牛马,哎,退伍没有包分配你真的亏了。
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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