적록색약
2023.09.11 (MON)
문제 : 백준 - 10026. 적록색약
조건 및 설명
접근법
- 두 가지(색약, 색약이 아닌)으로 나눈다.
- BFS로 한 구역씩 정한다.
결과 코드
import java.util.*;
import java.io.*;
public class Main {
static char[][] map;
static boolean[][] visited;
static ArrayDeque<Char> queue = new ArrayDeque<>();
static int no_Cb = 0;
static int yes_Cb = 0;
public static void main(String[] args) throws Exception {
int size;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
size = Integer.parseInt(st.nextToken()); // input size
// init
map = new char[size][size];
bvisited = new boolean[size][size];
// input
for (int i = 0; i < size; i++) {
st = new StringTokenizer(br.readLine());
String str = st.nextToken();
for (int j = 0; j < size; j++) {
map[i][j] = str.charAt(j);
visited[i][j] = false;
}
}
}
// 1. no Color blindness
public static int bfs_no(int start_x, int start_y char[][] map, boolean[][] visited) {
visited[start_x][start_y] = true;
queue.add(map[start_x][start_y]);
while (!queue.isEmpty()) {
char ch = queue.poll();
}
}
}