题解 | #密码强度等级#

二维数组操作

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);
            }
        }
    }
}
全部评论

相关推荐

鬼迹人途:你去投一投尚游游戏,服务器一面,第一个图算法,做完了给你一个策略题,你给出方案他就提出低概率问题,答不上当场给你挂
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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