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 |
3194 Runtime Error 3194怎么才会出现这个错误啊??搞N次了#include <stdio.h> void f(int x0,int y0,int s,int n,long a[150][150]) { a[x0][y0]=0; if(x0==0) { if(y0==0) { if(a[x0][y0+1]==s)f(x0,y0+1,s,n,a); if(a[x0+1][y0]==s)f(x0+1,y0,s,n,a); } else if(y0==n) { if(a[x0][y0-1]==s)f(x0,y0-1,s,n,a); if(a[x0+1][y0]==s)f(x0+1,y0,s,n,a); } else { if(a[x0][y0+1]==s)f(x0,y0+1,s,n,a); if(a[x0+1][y0]==s)f(x0+1,y0,s,n,a); if(a[x0][y0-1]==s)f(x0,y0-1,s,n,a); } } if(x0==n) { if(y0==0) { if(a[x0][y0+1]==s)f(x0,y0+1,s,n,a); if(a[x0-1][y0]==s)f(x0-1,y0,s,n,a); } else if(y0==n) { if(a[x0][y0-1]==s)f(x0,y0-1,s,n,a); if(a[x0-1][y0]==s)f(x0-1,y0,s,n,a); } else { if(a[x0][y0+1]==s)f(x0,y0+1,s,n,a); if(a[x0-1][y0]==s)f(x0-1,y0,s,n,a); if(a[x0][y0-1]==s)f(x0,y0-1,s,n,a); } } else { if(y0==0) { if(a[x0+1][y0]==s)f(x0+1,y0,s,n,a); if(a[x0][y0+1]==s)f(x0,y0+1,s,n,a); if(a[x0-1][y0]==s)f(x0-1,y0,s,n,a); } else if(y0==n) { if(a[x0+1][y0]==s)f(x0+1,y0,s,n,a); if(a[x0][y0-1]==s)f(x0,y0-1,s,n,a); if(a[x0-1][y0]==s)f(x0-1,y0,s,n,a); } else { if(a[x0][y0+1]==s)f(x0,y0+1,s,n,a); if(a[x0][y0-1]==s)f(x0,y0-1,s,n,a); if(a[x0+1][y0]==s)f(x0+1,y0,s,n,a); if(a[x0-1][y0]==s)f(x0-1,y0,s,n,a); } } } int main() { int n,i,j,x,y,t; long a[150][150]; while(EOF!=scanf("%d",&n)) { if(n==0)break; if(n==1)printf("good\n"); else { for(i=0;i<n;i++) for(j=0;j<n;j++) a[i][j]=0; for(i=1;i<n;i++) for(j=0;j<n;j++) { scanf("%d%d",&x,&y); a[x-1][y-1]=i; } for(i=0;i<n;i++) for(j=0;j<n;j++) if(a[i][j]==0)a[i][j]=n; for(x=1;x<=n;x++) { t=0; for(i=0;i<n;i++) { for(j=0;j<n;j++) { if(a[i][j]==x) { t=1; f(i,j,x,n-1,a); } if(t)break; } if(t)break; } } t=0; for(i=0;i<n;i++) { for(j=0;j<n;j++) if(a[i][j]!=0) { t=1; break; } if(t)break; } if(t)printf("wrong\n"); else printf("good\n"); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator