python解
查看原帖
python解
934466
KKKvX07楼主2024/6/15 10:20
def find_carpet(n, carpets, x, y):
    for i in range(n - 1, -1, -1):
        a, b, g, k = carpets[i]
        if a <= x <= a + g and b <= y <= b + k:
            return i + 1
    return -1

# 读取输入
n = int(input())
carpets = [list(map(int, input().split())) for _ in range(n)]
x, y = map(int, input().split())

# 计算并输出结果
print(find_carpet(n, carpets, x, y))
2024/6/15 10:20
加载中...