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:到底是哪里错了？？？试了好几次，真的不会改了！！求教大神，感激不尽

Posted by Lishuhao at 2015-04-20 14:02:28 on Problem 2386
In Reply To:到底是哪里错了？？？试了好几次，真的不会改了！！求教大神，感激不尽 Posted by:Alcatraz at 2015-04-12 01:50:48
```> #include<stdio.h>
> int n,m;
> char k[101][101];
> void change(int x,int y)
> {
> 	int dx,dy,nx,ny;
> 	for(dx=-1;dx<=1;dx++)
> 	{
> 		for(dy=-1;dy<=1;dy++)
> 		{
> 			nx=x+dx;
> 			ny=y+dy;
> 			if(nx>=0&&nx<n&&ny>=0&&ny<m&&k[nx][ny]=='W')
> 			{
> 				change(nx,ny);
> 			}
> 		}
> 	}
> }
> int main()
> {
>     //void change(int x,int y);
> 	int i,j,s;
>     int n,m;
>     char k[101][101];
> 	scanf("%d%d",&n,&m);
> 	for(i=0;i<n;i++)
> 	{
> 			scanf("%s",k[i]);
> 	}
> 	s=0;
> 	for(i=0;i<n;i++)
> 	{
> 		for(j=0;j<m;j++)
> 		{
> 			if(k[i][j]=='W')
> 			{
> 				s++;
> 				change(i,j);
> 			}
> 		}
> 	}
> 	printf("%d\n",s);
> 	return 0;
> }
```

Followed by: