티스토리 뷰

import java.io.IOException;
import java.util.*;

public class Main {
   public static void main(String[] args) throws IOException {

      Scanner sc = new Scanner(System.in);
          int x = sc.nextInt();
          int y = sc.nextInt();
          int w = sc.nextInt();
          int h = sc.nextInt();
      
          int left=0;
          int right=0;
          int bottom=0;
          int top=0;
        
      int[] length = new int[4];

          length[0] = x; //left
          length[1] = w-x; //right
          length[2] = y; //bottom
          length[3] = h-y;  //top

          int ret = 1001;

          for(int i=0; i<4; i++){
        if(ret>length[i]){

            ret= length[i];
                }


          }

          System.out.println(ret);



      
   } // end of Main
                 
} // end of class Main

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31