#include <iostream>
#include <vector>
using namespace std;
bool couple[10][10] = { false };
int n;
int check_out(bool student[]) {
int first = -1;
for (int i = 0; i < n; i++)
{
if (student[i] == false) {
first = i;
break;
}
}
if (first == -1)
return 1;
int ret = 0;
for (int next = first + 1; next < n; next++) {
if (student[next] == false && couple[first][next] == true)
{
student[first] = student[next] = true;
ret += check_out(student);
student[first] = student[next] = false;
}
}
return ret;
}
int main() {
int C;
cin >> C;
vector<int> answer;
bool student[10] = { false };
for (int i = 0; i < C; i++) {
int m;
cin >> n >> m;
for (int j = 0; j < m; j++) {
int a, b;
cin >> a >> b;
couple[a][b] = couple[b][a] = true;
}
answer.push_back(check_out(student));
}
for (int i = 0; i < answer.size(); i++)
cout << answer[i] << "\n";
}
nicesdr
이게 왜 실행이 안되는건지 이해가 안되네요 ㅠㅠ
10년 전