题解 | 最小包围盒

最小包围盒

https://www.nowcoder.com/practice/6921cfa52fdc42ccb1f5b3120ee41f80

t = int(input())
if t == 1:
    s=input()
    print(s,s)
else:
    x1, y1 = map(int, input().split())
    x2, y2 = map(int, input().split())
    for _ in range(t - 2):
        x, y = map(int, input().split())
        x1 = min(x1, x)
        y1 = min(y1, y)
        x2 = max(x2, x)
        y2 = max(y2, y)
    print(x1, y1, x2, y2)

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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