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

555 牛人看看啊 我是把上面三个和左边一个作为判断的依据 怎么调试是对的交了就 WA呢????????

Posted by ecjtuwh at 2006-10-25 20:24:52 on Problem 2386
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
  int i,j,k,m,n,sum,flag;
  char a[105][105];
  int b[105][105];
  for(i=1;i<=104;i++)
    for(j=0;j<=104;j++)
       b[i][j]=0;
  cin>>n>>m;
  for(i=1;i<=n;i++)
    for(j=1;j<=m;j++)
      {cin>>a[i][j];
      if(a[i][j]=='W') b[i][j]=1;
      } 
  sum=0;
  for(i=1;i<=n;i++)
    for(j=1;j<=m;j++,flag=1)
       {
       if(b[i][j]==1)
           {if(b[i-1][j-1]==0) ;
           else {flag=0;break;}
           if(b[i-1][j]==0) ;
           else {flag=0;break;}
           if(b[i-1][j+1]==0) ;
           else {flag=0;break;} 
           if(b[i][j-1]==0) ;
           else {flag=0;break;} 
           sum++;
           }// if
    }
cout<<sum<<endl;
}

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