[SSL1455 & 1456] electronic mouse maze Chuang & Knight Parade

Overview of test sites:

Search wide board

Questions surface:

\ [\ Large \ text {electronic mouse Chuang maze} \]
\ [~ Time Limit: 1000MS ~ ~ ~ Memory Limit: 65536k \]

Description

Below 12 × 12 grid map to find an entry from (2,9) to the shortest path to the outlet (11, 8) of.

Input

Output

Sample Input

12  //迷宫大小
2 9 11 8 //起点和终点
1 1 1 1 1 1 1 1 1 1 1 1  //邻接矩阵,0表示通,1表示不通
1 0 0 0 0 0 0 1 0 1 1 1
1 0 1 0 1 1 0 0 0 0 0 1
1 0 1 0 1 1 0 1 1 1 0 1
1 0 1 0 0 0 0 0 1 0 0 1
1 0 1 0 1 1 1 1 1 1 1 1
1 0 0 0 1 0 1 0 0 0 0 1
1 0 1 1 1 0 0 0 1 1 1 1
1 0 0 0 0 0 1 0 0 0 0 1
1 1 1 0 1 1 1 1 0 1 0 1
1 1 1 1 1 1 1 0 0 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1

Sample Output

(2,9)->(3,9)->(3,8)->(3,7)->(4,7)->(5,7)->(5,6)->(5,5)->(5,4)->(6,4)->(7,4)->(7,3)->(7,2)->(8,2)->(9,2)->(9,3)->(9,4)->(9,5)->(9,6)->(8,6)->(8,7)->(8,8)->(9,8)->(9,9)->(10,9)->(11,9)->(11,8)
27

\ [\ Large \ text {Knight procession} \]
\ [~ Time Limit: 1000MS ~ ~ ~ Memory Limit: 65536k \]

text:

Because it is the board, do not speak (Wide search the board can speak it ???) , Anyway, starting from the beginning to the end (nonsense) Statistical number of steps, would be finished.

Guess you like

Origin www.cnblogs.com/GJY-JURUO/p/11997318.html