Introduction - If you have any usage issues, please Google them yourself
A greedy snake in an n* m grid walk, it is only from one box to another box adjacent to the meaning here adjacent to the two squares have a common edge. Each square can be seen as a room, some of which are empty, some of the stored apples. Gluttonous snake did not enter an empty room, and enter the room with Apple can be taken away after all Apple to make the room become empty. Snake starting from a designated room, and eventually return to its home, the Apple store all the way to bring home, of course, it hopes to bring the apple up to. Write the program, enter the integers n and m and n* m of a matrix, the matrix element value is a-1, said the snake to the starting position, there is a 2, said the location of the snake' s home, and the remaining value non-negative integer, and 0 indicates that the room is empty, a non-zero integer number of Apple. Output snake choose to walk the path and get the maximum number of Apple.