voidcnt(int x, int y, int idx) { int res = 0; while (x <= R && y <= C && arr[x][y] == '.' && res < K) { x += walk[idx][0], y += walk[idx][1]; ++res; } if (res == K) ++ans; }
intmain() { cin >> R >> C >> K; for (int i = 1; i <= R; ++i) for (int j = 1; j <= C; ++j) cin >> arr[i][j]; for (int i = 1; i <= R; ++i) for (int j = 1; j <= C; ++j) cnt(i, j, 0), cnt(i, j, 1); // K等于1的时候会重复 cout << (K == 1 ? ans >> 1 : ans); return0; }