import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
int w = sc.nextInt();
int h = sc.nextInt();
int w_min; // 가로 거리의 최소값
int h_min; // 세로 거리의 최소값
w_min = ((w - x) > x) ? x : w - x;
h_min = ((h - y) > y) ? y : h - y;
if (w_min > h_min)
System.out.println(h_min);
else
System.out.println(w_min);
sc.close();
}
}
Algorithm백준+프로그래머스+SWEA+정올+구름카테고리의 다른글
크레인 인형뽑기 게임 (0) | 2021.04.01 |
---|---|
두 개 뽑아서 더하기 (0) | 2021.04.01 |
[Algorithm] 백준 2609 최대공약수와 최소공배수 (0) | 2021.03.25 |
[Algorithm] 백준 10870 피보나치 수 (0) | 2021.03.25 |
[Algorithm] 백준 1193 분수찾기 (0) | 2021.03.25 |