반응형
package ps.BJ.S5;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class BJ_S5_2563_색종이 {
static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
static StringBuilder output = new StringBuilder();
static StringTokenizer tokens;
static int N;
static int row, col, answer;
static boolean[][] map;
public static void main(String[] args) throws NumberFormatException, IOException {
N = Integer.parseInt(input.readLine());
map = new boolean[100][100];
int width = 0;
for (int n = 0; n < N; n++) {
tokens = new StringTokenizer(input.readLine());
row = Integer.parseInt(tokens.nextToken());
col = Integer.parseInt(tokens.nextToken());
for (int r = row; r < row + 10; r++) {
for (int c = col; c < col + 10; c++) {
if (map[r][c])
continue;
map[r][c] = true;
width++;
}
}
}
System.out.println(width);
}
}
반응형
'코딩테스트 > 백준문제' 카테고리의 다른 글
[Java] 백준_14696_딱지놀이 (0) | 2021.02.25 |
---|---|
[Java] 백준_11866_요세푸스문제0 (0) | 2021.02.10 |
[Java] 백준_17478_재귀함수가뭔가요 (0) | 2021.02.08 |
[Java] 백준_1244_스위치켜고끄기 (0) | 2021.02.08 |
[Java] 백준_15649_N과M(1) (0) | 2021.02.08 |