https://www.acmicpc.net/problem/2644 DFS 사용 #include using namespace std; int N, M; int per_a, per_b; int p, c; int cnt = -1; int sol = -1; int family[101][101]; int visited[100]; void dfs(int n, int now, int per_b){ visited[now] = 1; cnt++; if(now == per_b){ sol = cnt; return; } for(int i=1; i> N; cin >> per_a >> per_b; cin >> M; for(int i=0; i> p >> c; family[p][c] = 1; family[c][p] = 1; } } i..