백준 #1085번 직사각형에서 탈출

jhj·2024년 3월 3일

백준 JAVA

목록 보기
437/583
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 min = 0;
        
        min = Math.min(x, y);
        min = Math.min(min, w - x);
        min = Math.min(min, h - y);
        
        System.out.println(min);
        sc.close();
    }
}
profile
개발자를 꿈꾸는

0개의 댓글