problem
solution
codes
//尝试填每个点每种颜色填过去就好啦
#include<iostream>
using namespace std;
int n, e[10][10];
int c[10], ans;
void dfs(int cur){
if(cur == n)ans++;
else for(int i = 0; i < 4; i++){
c[cur] = i;
bool ok = true;
for(int j = 0; j < cur; j++)//判断和前面的点有没有冲突
if(e[j][cur] && c[j]==c[cur])//如果联通且同色那就翻车
{ ok = false; break; }
if(ok){
dfs(cur+1);
}
}
}
int main(){
cin>>n;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
cin>>e[i][j];
dfs(0);
cout<<ans<<"
";
return 0;
}