样例都过不去,查不出问题
#include <iostream>
#include <cstring>
using namespace std;
const long long MOD = 1e9 + 7;
int n,m;
long long f[105][105][105],ans;
bool c[105][105];
bool map[105][105][105];
long long dp(int N,int L,int R){
if(N == 0) return 1;
if(f[N][L][R] > -1) return f[N][L][R];
long long res = dp(N - 1,1,0);
for(int l = L;l <= R;l++){
if(map[N - 1][l][l]) continue;
for(int r = l;r <= R;r++){
if(map[N - 1][l][r]) break;
res = (res + dp(N - 1,l,r)) % MOD;
}
}
return f[N][L][R] = res;
}
int main(){
memset(f,-1,sizeof f);
cin >> n >> m;
for(int i = 1;i <= n;i++)
for(int j = 1;j <= m;j++){
char x;
cin >> x;
if(x == 'X') c[i][j] = 1;
}
for(int i = 1;i <= n;i++)
for(int j = 1;j <= m;j++){
map[i][j][j] = c[i][j];
for(int k = j + 1;k <= m;k++){
map[i][j][k] = map[i][j][k - 1] || c[i][k];
}
}
cout << dp(n + 1,1,m);
return 0;
}