Playground/자바문제집

[백준] 1085번

미숫가루설탕많이 2023. 1. 24. 19:48
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
   public static void main(String[] args) throws IOException{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      StringTokenizer st = new StringTokenizer(br.readLine(), " ");

      int x = Integer.parseInt(st.nextToken());
      int y = Integer.parseInt(st.nextToken());
      int w = Integer.parseInt(st.nextToken());
      int h = Integer.parseInt(st.nextToken());

      int x_min = Math.min(x, w - x);
      int y_min = Math.min(y, h - y);
      System.out.println(Math.min(x_min, y_min));
   }
}

'Playground > 자바문제집' 카테고리의 다른 글

[백준] 10250번  (0) 2023.01.24
[백준] 4153번  (0) 2023.01.24
[백준] 6840번  (0) 2023.01.24
[백준] 5522번  (0) 2023.01.24
[백준] 5341번  (0) 2023.01.24