https://www.acmicpc.net/problem/7576 코드import java.io.*;import java.util.*;public class Main { static int n, m; static int[][] arr; static boolean[][] visited; static Queue que; static int[] dx = {1, -1, 0, 0}; static int[] dy = {0, 0, 1, -1}; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Syste..
https://www.acmicpc.net/problem/10451코드import java.io.*;import java.util.*;public class Main { static int n; static boolean[] visited; static List> graph; static Queue que; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int T = Integer..
https://www.acmicpc.net/problem/11724 코드정답 import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.ArrayList;import java.util.LinkedList;import java.util.List;import java.util.Queue;import java.util.StringTokenizer;public class Main { static boolean[] visited; // 방문 노드 static Queue que; // bfs 노드 저장 static List> graph; static int n, ..
https://www.acmicpc.net/problem/14226 코드import java.io.*;import java.util.*;public class Main { static Queue que; static boolean[][] visited; static int s; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); s = Integer.parseInt(br.readLine()); que = new LinkedList(); visited..
https://www.acmicpc.net/problem/1743 코드음식물 쓰레기가 있는 지점에서 동서남북으로 이동하면서 쓰레기가 인접해 있는지 확인합니다.쓰레기를 만난 지점에서는 visited에 방문했음을 체크하고, 현재 탐색에서 다시는 방문하지 않도록 합니다.import java.io.*;import java.util.*;public class Main { static int[] dx = {1, -1, 0, 0}; static int[] dy = {0, 0, 1, -1}; static int[][] map; static int n, m, k; public static void main(String[] args) throws IOException { Buffer..