题解 | #二维数组操作#

二维数组操作

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

import java.util.*;

public class Main{

public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while(sc.hasNext()){
        int m = sc.nextInt(), n = sc.nextInt();
        int x1 = sc.nextInt(), y1 = sc.nextInt(), x2 = sc.nextInt(), y2 = sc.nextInt();
        //要插入的行
        int x = sc.nextInt();
        //要插入的列
        int y = sc.nextInt();
        //插入坐标
        int xAxis = sc.nextInt(), yAxis = sc.nextInt();
        if(m <= 9 && n <= 9) System.out.println(0);
        else System.out.println(-1);
        if(x1 < m && y1 < n && x2 < m && y2 < n) System.out.println(0);
        else System.out.println(-1);
        if(m + 1 <= 9 && x < m) System.out.println(0);
        else System.out.println(-1);
        if(n + 1 <= 9 && y < n) System.out.println(0);
        else System.out.println(-1);
        if(xAxis < m && yAxis < n) System.out.println(0);
        else System.out.println(-1);
    }
}

}

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-03 18:13
点赞 评论 收藏
分享
05-09 14:45
门头沟学院 Java
点赞 评论 收藏
分享
05-11 20:45
门头沟学院 Java
有担当的灰太狼又在摸...:零帧起手查看图片
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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