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

为什么是wa 有高人能指点一下吗

Posted by 00448322 at 2005-04-26 21:56:42 on Problem 2386
#include <iostream.h>

int num[104][104];

void main()
{
	int i,j;
	int n,m;
	char temp;
	int sum=0;
	cin>>n>>m;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			cin>>temp;
			if(temp=='W')
				num[i][j]=1;
			else
				num[i][j]=-1;
		}
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
		{
			if(num[i][j]==1)
			{
				if(num[i][j-1]==1 || num[i-1][j]==1 || num[i-1][j-1]==1 || num[i-1][j+1]==1)//判断之前出现的相邻点是否有'W' 
					continue;
				else//没有就加一个湖
					sum++;
			}
		}
	cout<<sum;
}




Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator