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 |
为什么是RUN TIME ERROR???#include <iostream> using namespace std; int pacex[5]={0,-1,1,0,0},pacey[5]={0,0,0,1,-1},count=1; inline void work(int x,int y,int a[][23]) { int i,tempx,tempy; for (i=1;i<=4;i++) { tempx=x+pacex[i]; tempy=y+pacey[i]; if (a[tempx][tempy]==0) { count++; a[tempx][tempy]=1; work(tempx,tempy,a); } } } void main() { int a[23][23]; int m,n,i,j; for (i=0;i<=22;i++) for (j=0;j<=22;j++) a[i][j]=1; char in,starti,startj; while (1) { for (i=1;i<=n;i++) for (j=1;j<=m;j++) a[i][j]=1; cin>>m>>n; if (m==0&&n==0) break; for (i=1;i<=n;i++) for (j=1;j<=m;j++) { cin>>in; if (in=='.') a[i][j]=0; if (in=='#') a[i][j]=1; if (in=='@') { a[i][j]=1; starti=i; startj=j; } } work(starti,startj,a); cout<<count<<endl; count=1; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator