백준 2606 java
-
boj)2606 - 바이러스PS/boj 2020. 9. 3. 13:05
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { static int n, m, node1, node2, cnt; static LinkedList[] nodeList; static boolean[] visited = new boolean[101]; public static void dfs(int node) { if (visited[node]) return; visited[node] = true; cnt++; for (int nextNode : nodeList[node]) { dfs(nextNode); } } public..