Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
555 牛人看看啊 我是把上面三个和左边一个作为判断的依据 怎么调试是对的交了就 WA呢????????#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator