-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGround.java
More file actions
35 lines (31 loc) · 1.13 KB
/
Copy pathGround.java
File metadata and controls
35 lines (31 loc) · 1.13 KB
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
32
33
34
35
package algorithm.baek.etc;
import algorithm.TestCase;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.ParseException;
import java.util.StringTokenizer;
/**
* https://www.acmicpc.net/problem/9063
* 대지
*/
public class Ground implements TestCase {
@Override
public void test() throws ParseException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
int tc = Integer.parseInt(br.readLine());
long x = Long.MIN_VALUE, y = Long.MIN_VALUE, minX = Long.MAX_VALUE, minY = Long.MAX_VALUE, maxX = Long.MIN_VALUE, maxY = Long.MIN_VALUE;
while (tc-- > 0) {
st = new StringTokenizer(br.readLine());
x = Long.parseLong(st.nextToken());
y = Long.parseLong(st.nextToken());
minX = Math.min(minX, x);
minY = Math.min(minY, y);
maxX = Math.max(maxX, x);
maxY = Math.max(maxY, y);
}
long res = (maxX - minX) * (maxY - minY);
System.out.println(res);
}
}