Maze time: 1000ms memory limit: 10000K Total time: 3000ms
Describe:
Determine if you can reach the exit from the entrance of the maze
Input:
Enter two integers to indicate the number of rows in the maze m and the number of columns N, and then the coordinates of the entry and exit, and the last M-line input maze, where 1 represents the wall, 0 indicates a space between each number has a space.
Output:
If it can be reached, the output is "Yes", otherwise the output "No", the result occupies a row.
Input Sample:
3 3
0 0
2 2
0 0 0
1 1 0
0 1 0
Sample output:
Yes
1#include <stdio.h>2#include <stdlib.h>3 inta[10000][10000],h,l;4 voidSearchintIintj)5 {6 if(a[i][j]==0)7 {8a[i][j]=2;9 if(J-1>=0)TenSearch (i,j-1); One if(i+1<h) ASearch (i+1, j); - if(j+1<l) -Search (i,j+1); the if(I-1>=0) -Search (I-1, j); - } - } + intMain () - { +scanf"%d%d",&h,&l); A intI,j,m,n; atscanf"%d%d",&i,&j); -scanf"%d%d",&m,&n); - intt,b; - for(t=0; t) - for(b=0; b<l; b++) -scanf"%d",&a[t][b]); in search (i,j); - if(a[m][n]==2) toprintf"yes\n"); + Else -printf"no\n"); the return 0; *}
"Recursion" Go maze