#include #include using namespace std; #define FF(x, y, z) for(int x =y; x < z; x++) vector> snows; int N, M, Q; int sum_snow(int t) { int res = 0; FF(x, 0, M) { int left = t; for (int y = N-1; y >= 0; y--) { if (snows[y][x] == '.') { left--; if (left < 0) break; } if (snows[y][x] == '*' && left >= 0) res++; } } return res; } int main() { cin >> N >> M >> Q; snows.resize(N); vector v(N, 0); vector a(N, 0); FF(y, 0, N) { snows[y].resize(M); FF(x, 0, M) { char c; cin >> c; snows[y][x] = c; } } FF(x, 0, M) { int air = 0; for (int y = N-1; y >= 0; y--) { if (snows[y][x] == '*') { v[air]++; } else { air++; } } } int sum =0; FF(i, 0, N) { sum += v[i]; a[i] = sum; } FF(i, 0, Q) { int t; cin >> t; t = t >= N ? N-1 : t; cout << a[t] << endl; } return 0; }