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

## 跪求求大神指导！测了多数据了，都过了，为啥WA ??????

Posted by bj921712230 at 2013-04-21 20:31:42 on Problem 1562
```#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main(){
int i,j,count,r,c;
char b;

while (scanf("%d%d",&r,&c)&&(r!=0||c!=0)){
int a[110][110];
getchar();
count=1;

for(i=0;i<=r;i++)
for(j=0;j<=c+1;j++){
if(j==0){a[i][j]=-1;j++;}
if(i==r||j==c+1) a[i][j]=-1;
else{
cin>>b;
if(b=='@') a[i][j]=0;
else a[i][j]=-1;
}
}

for(i=0;i<r;i++)
for(j=1;j<=c;j++)
{
if(a[i+1][j-1]>0&&a[i][j]==0) a[i][j]=a[i+1][j-1];
if(a[i][j]==0||a[i][j]>0)
{
if(a[i][j]==0) count++;
a[i][j]=count;
if(a[i+1][j-1]==0) a[i+1][j-1]=a[i][j];
if(a[i+0][j+1]==0) a[i+0][j+1]=a[i][j];
if(a[i+1][j+0]==0) a[i+1][j+0]=a[i][j];
if(a[i+1][j+1]==0) a[i+1][j+1]=a[i][j];
}
}

printf("%d\n",count-1);
}
return 0;
}```

Followed by: