rt.蒟蒻实在不知道咋调了(我只管把 WA 的点 AC)。
代码
#include<bits/stdc++.h>
using namespace std;
const int mod=100000000;
int n,m,ans=1;
bool a[15][15],b[15][15];
void dfs(int x,int y){
if(b[x][y]||!a[x][y]){
if(y<m){
dfs(x,y+1);
}else if(x<n){
dfs(x+1,1);
}
}else{
if(y<m){
dfs(x,y+1);
}else if(x<n){
dfs(x+1,1);
}
ans=(ans+1)%mod;
b[x][y]=b[x+1][y]=b[x-1][y]=b[x][y-1]=b[x][y+1]=1;
if(y<m){
dfs(x,y+1);
}else if(x<n){
dfs(x+1,1);
}
b[x][y]=b[x+1][y]=b[x-1][y]=b[x][y-1]=b[x][y+1]=0;
}
}
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];
}
}
dfs(1,1);
cout<<ans%mod;
return 0;
}