#include #include #include using namespace std; #define MAXMONEY 300 int H, W; vector> cells; int check() { char cell; cin >> cell; if (cell == 'o') return 1; else if (cell == 'x') return -1; else return 0; } int walk(int i, int j, int sum) { int cnt = 0; if (cells[i][j] == 0) // 通行止め return cnt; else // 通行可能 sum += cells[i][j]; if (sum < 0) return cnt; // cout << i << ' ' << j << ' ' << sum << endl; if (i == H - 1 && j == W - 1) // goal return 1 ? sum > 0 : 0; if (i < H - 1) cnt += walk(i + 1, j, sum); // down if (j < W - 1) cnt += walk(i, j + 1, sum); // right return cnt; } int main() { cin >> H >> W; cells = vector>(H, vector(W)); for (int i = 0; i < H; ++i) { for (int j = 0; j < W; ++j) { cells[i][j] = check(); // cout << cells[i][j] << ' '; } // cout << endl; } int cnt = walk(0, 0, 0); // cout << H << W << endl; cout << cnt << endl; }