Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## Re:狂晕中，实在找不到错啊，但还是WA，哪位大哥帮忙看下有什么问题

Posted by sugus811 at 2014-04-18 11:02:31 on Problem 2386
In Reply To:狂晕中，实在找不到错啊，但还是WA，哪位大哥帮忙看下有什么问题 Posted by:zhangli00 at 2007-05-09 14:30:56
```> #include <iostream>
> using namespace std;
> int M,N;
> int b[102][102];
> int a[8][2]={1,1,1,0,1,-1,0,1,0,-1,-1,1,-1,0,-1,1};
> void DFS(int m,int n){
> 	b[m][n]=0;
> 	for(int t=0;t<8;t++){
> 			if(b[m+a[t][0]][n+a[t][1]]==1)
> 				DFS(m+a[t][0],n+a[t][1]);
> 	}
> }
> int main(){
> 	//freopen("a.in","r",stdin);
> 	int i,j,count;
> 	char ch;
> 	while(cin>>M>>N&&(M!=0||N!=0)){
> 		count=0;
> 		memset(b,0,sizeof(b));
> 	for(i=1;i<=M;i++)
> 		for(j=1;j<=N;j++){
> 			cin>>ch;
> 			if(ch=='W')b[i][j]=1;
> 			else b[i][j]=0;
> 		}
> 		for(i=1;i<=M;i++)
> 			for(j=1;j<=N;j++)
> 				if(b[i][j]==1){
> 				    DFS(i,j);
> 					count++;
> 				}
> 				cout<<count<<endl;
> 				}
> 				return 0;
> }
```

Followed by: