
메모리: 113112 KB, 시간: 112 ms
수학, 기하학
한수는 지금 (x, y)에 있다. 직사각형은 각 변이 좌표축에 평행하고, 왼쪽 아래 꼭짓점은 (0, 0), 오른쪽 위 꼭짓점은 (w, h)에 있다. 직사각형의 경계선까지 가는 거리의 최솟값을 구하는 프로그램을 작성하시오.
첫째 줄에 x, y, w, h가 주어진다.
첫째 줄에 문제의 정답을 출력한다.
#https://www.acmicpc.net/problem/1085
#직사각형에서 탈출
#1085
import sys
input = sys.stdin.readline
x, y, w, h = map(int, input().split())
# print(x)
# print(y)
# print(w)
# print(h)
print(min(x,y,w-x,h-y))
#https://www.acmicpc.net/problem/1085
#직사각형에서 탈출
#1085
import sys
input = sys.stdin.readline
x, y, w, h = map(int, input().split())
def fun(x, y, w, h):
global result
result = min(x, y, w-x, h-y)
return print(result)
fun(x, y, w, h)