/
BAEKJOON 10163
37 lines (33 loc) · 948 Bytes
/
BAEKJOON 10163
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
36
37
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
int[][] arr = new int[1001][1001];
for (int t = 1; t <= T; t++) {
StringTokenizer st = new StringTokenizer(br.readLine());
int sy = Integer.parseInt(st.nextToken());
int sx = Integer.parseInt(st.nextToken());
int ey = Integer.parseInt(st.nextToken());
int ex = Integer.parseInt(st.nextToken());
for (int i = sy; i <sy+ey; i++) {
for (int j = sx; j <sx+ex; j++) {
arr[j][i] = t;
}
}
}
for (int t = 1; t <= T; t++) {
int count = 0;
for (int i = 0; i < 1001; i++) {
for (int j = 0; j < 1001; j++) {
if (arr[i][j] == t) {
count++;
}
}
}
System.out.println(count);
}
}
}