-
Notifications
You must be signed in to change notification settings - Fork 0
/
prob10163.java
38 lines (34 loc) · 1014 Bytes
/
prob10163.java
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
38
package sw_typeIM;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
//백준 10163 색종이
public class prob10163 {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(bf.readLine());
int[][] map = new int[102][102];
for (int i = 1; i <= N; i++) {
StringTokenizer st = new StringTokenizer(bf.readLine()," ");
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
int width = Integer.parseInt(st.nextToken());
int height = Integer.parseInt(st.nextToken());
for (int j = 0; j < height; j++) {
for (int j2 = 0; j2 < width; j2++) {
map[101-y-j][x+j2] = i;
}
}
}
int result = 0;
for (int k = 1; k <= N; k++) {
result = 0;
for (int i = 0; i < 102; i++) {
for (int j = 0; j < 102; j++) {
if(map[i][j]==k) result++;
}
}
System.out.println(result);
}
}
}