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 |
因为RE所以RE..In Reply To:为什么我Runtime Error? 有代码 Posted by:bmexue at 2006-10-31 10:37:28 > #include <iostream> > using namespace std; > > char D[82][1002]; > bool Fir[82][1002]; > int Rst[80002]; > int W,H,N; > > void work(int i, int j) > { > Fir[i][j] =true; > Rst[N]++; > if(i>0) //ok > { > if(D[i-1][j] == '*'&& !Fir[i-1][j] ) > { > > work(i-1,j); > } > } > if(i< (H-1)) //ok > { > if(D[i+1][j] == '*'&& !Fir[i+1][j] ) > { > work(i+1,j); > } > } > if(j>0) //ok > { > if(D[i][j-1] == '*'&& !Fir[i][j-1] ) > { > work(i,j-1); > } > } > if(j<(W-1)) //ok > { > if(D[i][j+1] == '*'&& !Fir[i][j+1] ) > { > work(i,j+1); > } > } > } > void init() > { > for(int i=0;i<H;i++) > { > for(int j=0;j<W;j++) > Fir[i][j] = false; > } > for(i=0;i<N*W;i++) > Rst[i] = 0; > N = 0; > } > int main() > { > char c[1005]; > while(scanf("%d%d",&W,&H)!=EOF) > { > gets(c); > int i,j; > for(i=0;i<H;i++) > { > gets(c); > for(j=0;j<W;j++) > D[i][j]=c[j]; > } > init(); > for(i=0;i<H;i++) > { > for(j=0;j<W;j++) > { > if(D[i][j] == '*'&& !Fir[i][j] ) > { > work(i,j); > N++; > } > } > > } > int tmp=0; > i=0; > while(i<N) > { > if(Rst[i]>tmp) > tmp = Rst[i]; > i++; > } > printf("%d\n",tmp); > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator