🧩PS/🥉Easy
[JAVA] 백준 3009번 - 네 번째 점
Cocoon_
2021. 10. 4. 22:02
반응형
<코드>
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x1 = sc.nextInt();
int y1 = sc.nextInt();
int x2 = sc.nextInt();
int y2 = sc.nextInt();
int x3 = sc.nextInt();
int y3 = sc.nextInt();
int x4,y4;
if(x1 == x2) {
x4 = x3;
}
else if(x1 == x3){
x4 = x2;
} else{
x4 = x1;
}
if(y1 == y2) {
y4 = y3;
}
else if(y1 == y3){
y4 = y2;
} else{
y4 = y1;
}
System.out.println(x4+" "+y4);
}
}
https://www.acmicpc.net/problem/3009
3009번: 네 번째 점
세 점이 주어졌을 때, 축에 평행한 직사각형을 만들기 위해서 필요한 네 번째 점을 찾는 프로그램을 작성하시오.
www.acmicpc.net
반응형