#include #include #include using namespace std; #define MAXMONEY 300 int H, W; vector> cells; int check() { string cell; cin >> cell; if (cell == "o") return 1; else if (cell == "x") return -1; else return 0; } int walk(int i, int j, uint sum) { int cnt = 0; if (cells[i][j] == 0) // 通行止め return cnt; else // 通行可能 sum += cells[i][j]; 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(); int cnt = 0; cnt += walk(0, 0, 0); cout << cnt << endl; }