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 |
急求牛人看看!!!!!! RTE 都n次了!!!#include <iostream> using namespace std; int Dir[4][2] = { {0,-1}, {0,1}, {-1,0}, {1,0} }; char Map[81][1001]; int Count,Min; int W,H; void DFS(int I,int J) { Count++; if(Min < Count) Min = Count; Map[I][J] = '.'; for(int k=0; k<4; k++) { int x = I + Dir[k][0]; int y = J + Dir[k][1]; if( Map[x][y] == '*' && x>=0 && x<H && y>=0 && y<W ) DFS(x,y); } Count = 0; } int main() { int i,j,k; while(cin>>W>>H) { //cin.get(); for(i=0,Count=0,Min=0; i<H; i++) for(j=0; j<W; j++) cin>>Map[i][j]; for(i=0; i<H; i++) for(j=0; j<W; j++) if(Map[i][j] == '*') DFS(i,j); cout<<Min<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator