-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2563_색종이.java
More file actions
32 lines (30 loc) · 1.13 KB
/
2563_색종이.java
File metadata and controls
32 lines (30 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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
static int[][] map = new int[100][100]; //고정맵
static int N, x, y;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
N = Integer.parseInt(st.nextToken());
for(int i=0; i<N; i++) { // 반복동안 x,y좌표부터 10by10 공간 1로 할당
st = new StringTokenizer(br.readLine());
x = Integer.parseInt(st.nextToken());
y = Integer.parseInt(st.nextToken());
for(int k=x; k<x+10; k++) {
for(int l=y; l<y+10; l++) {
map[k][l] = 1;
}
}
}
int sum = 0;
for(int i=0; i<100; i++) { //배열을 완전탐색하면서 1인공간의 합을 구함
for(int j=0; j<100; j++) {
if(map[i][j] == 1) sum++;
}
}
System.out.println(sum);
}
}