CodePudding user response:
First give you an idea, matrix is two-dimensional array, then read every two dimensional array, the first can judge from the first line, shadow, first column, column, four corners walk through, first line only, the first column can only right so on, can't go through the output cannot go through, you can record every step, so that can solve the first problem, temporarily didn't want to see the secondCodePudding user response:
The two-dimensional array elements are stored in each node in the direction of walking robot canTo solve this problem, to be a two-dimensional array of the size of the auxiliary, type is an int type, and the values are initialized to 0.
Starting from the initial point, corresponding auxiliary array data is set to 1, the first step is the current go
Since every step forward to judge whether the new location of auxiliary array is 0, 0 means no here, the auxiliary array is set to the current steps taken
Steps if you can go out and the total natural knew, if circulation, is met with an old old position through the secondary data values are not 0. To close loop
CodePudding user response:
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html