반응형
SMALL
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int max_x = Integer.MIN_VALUE;
int min_x = Integer.MAX_VALUE;
int max_y = Integer.MIN_VALUE;
int min_y = Integer.MAX_VALUE;
for(int i = 0 ; i < n ; i ++){
int x = sc.nextInt();
int y = sc.nextInt();
max_x = Math.max(max_x,x);
min_x = Math.min(min_x,x);
max_y = Math.max(max_y,y);
min_y = Math.min(min_y,y);
}
int value_x = max_x - min_x;
int value_y = max_y - min_y;
int result = value_x * value_y;
System.out.print(result);
}
}
배열로도 해결 가능
반응형
LIST
'JAVA > JAVA baekjoon' 카테고리의 다른 글
11653번 소인수분해 (0) | 2023.08.30 |
---|---|
14215번 세 막대 (0) | 2023.08.29 |
1978번 소수 찾기 (0) | 2023.08.28 |
9506번 약수들의 합 (0) | 2023.08.28 |
2501번 약수구하기 (0) | 2023.08.28 |