티스토리 뷰

 

 

  find last rectengle point 

  5 5
  5 7
  7 5

  ans: 7 7

  x  y
  30 20
  10 10
  10 20

  ans : 30 10 

first, load the number. 
then, find diffrent number from values of x.  and y too. 


case 

1. 5 5 7 
2. 5 7 5 
3. 7 5 5 

 

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 ret_x=0;
          int ret_y=0; 
      
          int[] x = new int[3];
          int[] y = new int[3];


          for(int i=0; i<3; i++){
         x[i] = sc.nextInt();
         y[i] = sc.nextInt();

          }

              if(x[0]==x[1]){ //case 1 
              ret_x =x[2]; 
                  }
                  if(x[0]!=x[1]){
             if(x[0]==x[2]){  //case 2

              ret_x = x[1];
                         }
                         else{
                ret_x = x[0]; //case 3

                         }

                  }
              

          if(y[0]==y[1]){ //case 1 
              ret_y =y[2]; 
                  }
                  if(y[0]!=y[1]){
             if(y[0]==y[2]){  //case 2

              ret_y = y[1];
                         }
                         else{
                ret_y = y[0]; //case 3

                         }

                  }

                  System.out.println(ret_x+" "+ret_y);
   } // 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