[백준] 1085번: 직사각형에서 탈출 자바(JAVA)
·
JAVA/백준(BAEK JOON)
풀이import java.util.Arrays;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); //(x,y)에 위치 int y = sc.nextInt(); int w = sc.nextInt(); //직사각형 오른쪽 위 꼭지점(w,h) int h = sc.nextInt(); int[] arr = new int[4]; arr[0] = h-y; arr[1] = w-x; arr[2] = y; arr[3] = x; Arrays.sort(arr); System.out.pr..