0分,求调
#include<bits/stdc++.h>
using namespace std;
int num,a[15][15];
bool hx[15][15],lx[15][15],fg[15][15];
void dfs(int x,int y){
if(x==5){
num++;
}
if(a[x][y]!=0){
if(y==9)
dfs(x+1,1);
else
dfs(x,y+1);
}
else{
for(int i=1;i<=9;i++){
if(hx[x][i]==0&&lx[y][i]==0){
a[x][y]=i;
hx[x][i]=1;
lx[y][i]=1;
if(y==9) dfs(x+1,1);
else dfs(x,y+1);
hx[x][i]=0;
lx[y][i]=0;
a[x][y]=0;
}
}
}
}
int main(){
int x;
for(int i=1;i<=9;i++)
for(int j=1;j<=9;j++){
cin>>x;
if(x!=0){
hx[i][x]=1;
lx[j][x]=1;
a[i][j]=x;
}
}
dfs(1,1);
cout<<num;
return 0;
}