너비 우선 탐색(2)
-
C# 2667번 단지번호붙이기
코드 : using System; using System.Collections.Generic; namespace _3 { class Program { static int N; //맵 저장 행렬 static int[,] map = new int[26, 26]; //단지내의 집의 수 저장 행렬 static int[] houseCount = new int[1000]; //방문 확인 행렬 static bool[,] visited = new bool[26,26]; static Queue queue = new Queue(); static int[] dx = { -1, 1, 0, 0 }; static int[] dy = { 0, 0, -1, 1 }; //단지수 static int count = 0; //단지내의 집수..
2022.03.04 -
C# 1260번 DFS와 BFS
코드 : using System; using System.Collections.Generic; namespace _1 { class Program { static int[] input; static int N; static int M; static int V; static public int[,] map = new int[1001, 1001]; static public bool[] visited = new bool[1001]; static public Queue queue = new Queue(); static public Stack stack = new Stack(); static void Reset() { for (int i = 1; i
2022.03.04