题解 | #二维数组操作#

二维数组操作

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

# -*-coding:utf-8-*-
while True:
    try:
        i_xy,swap_xy,insert_x,insert_y,find_xy=list(map(int,input().split())),list(map(int,input().split())),int(input()),int(input()),list(map(int,input().split()))
        if i_xy[0] <= 9 and i_xy[1] <= 9:#初始化
            print("0")
        else:
            print("-1")
        if max(swap_xy[0],swap_xy[2]) <= i_xy[0]-1 and max(swap_xy[1],swap_xy[3]) <= i_xy[1]-1:#交换坐标
            print("0")
        else:
            print("-1")
        if (insert_x>=0) and (insert_x <= i_xy[0] ) and (1 + i_xy[0] <= 9) :#插入行
            print("0")
            insert_x_flag =1
        else:
            print("-1")
            insert_x_flag =0
        if (insert_y >=0) and (insert_y <= i_xy[1]-1) and (1 + i_xy[1] <= 9) :#插入列
            print("0")
            insert_y_flag=1
        else:
            print("-1")
            insert_y_flag=0
        if (find_xy[0] <= i_xy[0]-1) and (find_xy[1] <= i_xy[1]-1):#查找
            print("0")
        else:
            print("-1")
    except:
        break

全部评论

相关推荐

三年之期已到我的offer快到碗里来:9硕都比不上9本
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务