-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ10163.java
More file actions
48 lines (35 loc) · 1.14 KB
/
Copy pathJ10163.java
File metadata and controls
48 lines (35 loc) · 1.14 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
36
37
38
39
40
41
42
43
44
45
46
47
48
package TIL;
import java.io.*;
public class J10163{
public static void main(String[] args) throws IOException{
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
int n= Integer.parseInt(buffer.readLine());
int[][] arr = new int[1001][1001];
int[] cnt = new int[n+1];
for(int i = 1; i<=n; i++){
String[] input = buffer.readLine().split(" ");
int x = Integer.parseInt(input[0]);
int y = Integer.parseInt(input[1]);
int w = Integer.parseInt(input[2]);
int h = Integer.parseInt(input[3]);
y =1001-y-1;
h = y-h;
w = x+w;
for(int j = y; j>h; j--){
for(int k = x; k<w; k++){
arr[j][k] = i;
}
}
}
int num = 1;
for(int i = 1; i<n+1; i++) {
for (int j = 0; j < 1001; j++) {
for (int k = 0; k < 1001; k++) {
if (arr[j][k] == i)
cnt[i]++;
}
}
System.out.println(cnt[i]);
}
}
}