code:
#include<bits/stdc++.h>
using namespace std;
struct F{
int x;
int y;
};
queue<F>q;
char a[210][210];
bool p[210][210];
unsigned int num=0;
int n;
short dir[4][2]={{1,0},(-1,0),(0,1),{0,-1}};
int main(){
p[0][0]=0;
string h;
cin >> n;
getline(cin,h);
for(int i=1;i<=n;i++){
getline(cin,h);
a[i][0]=h.length();
for(int j=1;j<=a[i][0];j++){
a[i][j]=h[j-1];
int A=(int)a[i][j];
if(A==32||A==42)p[i][j]=1;
}
}//i竖j横x竖y横
for(int i=1;i<=n;i++){
for(int j=1;j<=a[i][0];j++){
if(p[i][j]==0){
p[i][j]=1;
q.push({i,j});
while(!q.empty()){
int xx=q.front().x;
int yy=q.front().y;
q.pop();
for(int i=0;i<4;i++){
int tx=xx+dir[i][0];
int ty=yy+dir[i][1];
if(tx>=1&&tx<=n&&ty>=1&&ty<=a[tx][0]&&p[tx][ty]==0){
p[tx][ty]=1;
q.push({tx,ty});
}
}
}
num++;
}
}
}
cout<<num;
return 0;
}
哪位巨佬能看出这有什么问题嘛