题解 | #二维数组操作#

二维数组操作

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);
    }
}

}

全部评论

相关推荐

昨天 14:32
已编辑
上海应用技术大学 运营
青春运维少年不会梦到...:实习大王
点赞 评论 收藏
分享
12-06 16:17
济宁学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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