백준 13221 Manhattan [Python]

지구온난화·2023년 3월 24일
0

백준 브론즈

목록 보기
32/52
me_x, me_y = map(int, input().split())
n = int(input())
min = 201
X = me_x
Y = me_y
for i in range(n):
    taxi_x, taxi_y = map(int, input().split())
    x = abs(taxi_x-me_x)
    y = abs(taxi_y-me_y)
    if min > x+y:
        min = x+y
        X = taxi_x
        Y = taxi_y
print("{0} {1}".format(X, Y))

2023-03-24

0개의 댓글