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

求助

Posted by lzxjxsy at 2006-11-05 15:18:50 on Problem 1185
过了的大哥帮我看看我的代码哪里出问题了,谢谢,总是wa


#include <iostream>
using namespace std;

void main()
{
	int nKey[102][12];
	memset((void*)nKey,0, 4*102*12); 
	int m, n, i, j, nCount;
	nCount = 0;
	cin >> m >> n;
	for(i=0; i<m; i++)
	{
		char szTmp[10];
		cin >> szTmp ;
		for(j=0; j<n; j++)
		{
			if(szTmp[j]=='P')
			{
				if (nKey[i][j]==0)
				{
					nCount ++;
					nKey[i+1][j] = 1;
					nKey[i+2][j] = 1;
					nKey[i][j++] = 1;
					nKey[i][j++] = 1;
				}
			}
		}
	}
	printf("%d\n", nCount );
}

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