题解 | #密码强度等级#

二维数组操作

http://www.nowcoder.com/practice/2f8c17bec47e416897ce4b9aa560b7f4

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int r = sc.nextInt();
            int c = sc.nextInt();
            
            int r1 = sc.nextInt();
            int c1 = sc.nextInt();
            int r2 = sc.nextInt();
            int c2 = sc.nextInt();
            
            int r3 = sc.nextInt();
            int c3 = sc.nextInt();
            
            int r4 = sc.nextInt();
            int c4 = sc.nextInt();
            
            if(r<=9 && c<=9){
                System.out.println(0);
            }else{
                System.out.println(-1);
            }
            
            if(r1<r && c1<c && r2<r && c2<c){
                System.out.println(0);
            }else{
                System.out.println(-1);
            }
            
            if(r+1<=9 && r3<r){
                System.out.println(0);
            }else{
                System.out.println(-1);
            }
            
            if(c+1<=9 && c3<c){
                System.out.println(0);
            }else{
                System.out.println(-1);
            }
            
            if(r4<=r-1 && c4<=c-1){
                System.out.println(0);
            }else{
                System.out.println(-1);
            }
        }
    }
}
全部评论

相关推荐

06-12 10:50
门头沟学院 Java
你的不定积分没加C:我怎么在学院群看到了同样的话
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
06-11 13:34
offe从四面八方来:我真的没时间陪你闹了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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