From c71befc13792bdd83253f41cfc0f7634ac434a04 Mon Sep 17 00:00:00 2001 From: JunhwiLee Date: Thu, 30 May 2024 14:49:50 +0900 Subject: [PATCH] 1068 --- .../n1068.java" | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 "\354\235\264\354\244\200\355\234\230/n1068.java" diff --git "a/\354\235\264\354\244\200\355\234\230/n1068.java" "b/\354\235\264\354\244\200\355\234\230/n1068.java" new file mode 100644 index 00000000..c13b81fa --- /dev/null +++ "b/\354\235\264\354\244\200\355\234\230/n1068.java" @@ -0,0 +1,47 @@ +package baekjoon; +import java.util.*; +public class n1068 { + static int[] arr = new int[50]; + static boolean[][] vertex = new boolean[50][50]; + static boolean[] visited = new boolean[50]; + static int result=0; + static void dfs(int n) { + boolean check = false; + //System.out.println(n); + visited[n] = true; + for(int i = 0; i<50; i++) { + if(vertex[n][i] && !visited[i]) { + visited[i] = true; + dfs(i); + check = true; + } + } + if(!check) result++; + + } + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int top = 0; + for(int i = 0; i