문제 링크입니다: https://www.acmicpc.net/problem/11724 DFS(Depth First Search) 또는 BFS(Breadth First Search) 알고리즘을 사용하여 풀 수 있는 문제였습니다.무방향 그래프(Undirected Graph)이기 때문에 양쪽 정점을 모두 연결해주고 DFS를 통해 연결 요소들의 개수를 찾으면 쉽게 풀 수 있는 문제였습니다. #include #include using namespace std; const int MAX = 1000 + 1; int M, N; vector graph[MAX]; bool visited[MAX]; //전형적인 DFS void DFS(int node) { visited[node] = true; for (int i = 0;..