// 2005‘“à—\‘IF Cleaning Robot #include #include #include #include #include using namespace std; int w, h; string b[20]; int step[20][20]; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; void bfs(int x, int y){ memset(step, -1, sizeof(step)); queue< pair > qu; qu.push(make_pair(x,y)); step[x][y] = 0; while(!qu.empty()){ pair pr = qu.front(); qu.pop(); int cx = pr.first, cy = pr.second; for(int i=0;i<4;i++){ int nx = cx+dx[i], ny = cy+dy[i]; if(nx<0||h<=nx||ny<0||w<=ny||b[nx][ny]=='x'||step[nx][ny]!=-1) continue; step[nx][ny] = step[cx][cy]+1; qu.push(make_pair(nx,ny)); } } } int main(){ int c[11][11]; while(cin >> w >> h, w){ for(int i=0;i> b[i]; vector x(1), y(1); for(int i=0;i a(x.size()-1); for(int i=0;i