From 310dd71304331caef2f82db0bcfaef00a9bf6bff Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Wed, 26 Nov 2025 16:44:38 +0900 Subject: [PATCH] =?UTF-8?q?[20251126]=20BOJ=20/=20G4=20/=20=ED=8D=BC?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EB=93=9C=20/=20=EC=9D=B4=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...5\274\353\240\210\354\235\264\353\223\234" | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 "LiiNi-coder/202511/26 BOJ \355\215\274\353\240\210\354\235\264\353\223\234" diff --git "a/LiiNi-coder/202511/26 BOJ \355\215\274\353\240\210\354\235\264\353\223\234" "b/LiiNi-coder/202511/26 BOJ \355\215\274\353\240\210\354\235\264\353\223\234" new file mode 100644 index 00000000..93a50894 --- /dev/null +++ "b/LiiNi-coder/202511/26 BOJ \355\215\274\353\240\210\354\235\264\353\223\234" @@ -0,0 +1,72 @@ +```java +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.*; + +public class Main{ + private static int V; + private static int E; + private static List> graph; + private static boolean[] visited; + private static int maxPassedVertex; + public static void main(String[] args) throws IOException { + String[] temp; + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + temp = br.readLine().split(" "); + V = Integer.parseInt(temp[0]); + E = Integer.parseInt(temp[1]); + + graph = new ArrayList<>(); + + int[] ds = new int[V+1];//degreesAtVertex + for(int i = 0; i < V+1; i++){ + graph.add(new ArrayList<>() ); + } + for (int i = 0; i < E; i++) { + temp = br.readLine().split(" "); + int s = Integer.parseInt(temp[0]); + int e = Integer.parseInt(temp[1]); + ds[s]++; + ds[e]++; + graph.get(s).add(e); + graph.get(e).add(s); + } + + visited = new boolean[V+1]; + visited[1] = true; + dfs(1, 1); + maxPassedVertex = 0; + for(int i = 1; i < V+1; i++){ + if(visited[i]) maxPassedVertex++; + } + if(maxPassedVertex != V){ + //System.out.println(maxPassedVertex + " " + V); + System.out.println("NO"); + System.exit(0); + } + + int odd = 0; + for(int i = 1; i