|
|
back to boardWhy Compilation Error ???????????????????? int pole[100][100]; int main() { int mx1,my1,mx2,my2,l,flag; l=0; flag= 0; int n,m; scanf("%d %d",&m,&n); scanf("%d %d",&mx1,&my1); scanf("%d %d",&mx2,&my2); pole[mx1][my1] = pole[mx2][my2] = 2; int i; for(i=0;i<=n+1;i++) { pole[0][i] = pole[m+1][i] = 1; } for(i=0;i<=m+1;i++) { pole[i][0] = pole[i][n+1] = 1; } int x=1,y=1,dx=0,dy=1; if(pole[x][y]==2) flag = 1; pole[x][y] = 1; while(1) { if(pole[x+dx][y+dy]!=1) { x+=dx; y+=dy; if(pole[x][y]==2) { if(flag) { printf("%d",l+1); return(0); } else { flag = 1; l=0; } } else l++; pole[x][y] = 1; } else { if(dy==1) { dy=0; dx=1; } else if(dx==1) { dx=0; dy=-1; } else if(dy==-1) { dy=0; dx=-1; } else if(dx==-1) { dx=0; dy=1; } } } return(0); } Re: Why Compilation Error ???????????????????? #include <stdio.h> Add #include <stdio.h> Add #include <stdio.h> |
|
|