【提问】谁会啊
pascal吧
全部回复
仅看楼主
level 11
1043: 广度优先搜索BFS - 下棋时间限制: 1 Sec 内存限制: 128 MB
[提交][状态][讨论版]题目描述
大家知道象棋中的马是一个很有意思的棋子。它的行走方式是一个“日”子。现在给出棋盘上2个点的位置,让你算计马可以最少花多少步跳过去。
输入
有多组输入,每组数据有2个点,行由小写字母(a-h)表示,列由数字(1-8)表示。
输出
对应每组输入数据,输出一句话"To get from xx to yy takes n knight moves.". 表示从一个点到另一个点需要多少步。详见样例。
样例输入e2 e4a1 b2b2 c3a1 h8a1 h7h8 a1b1 c3f6 f6样例输出To get from e2 to e4 takes 2 knight moves.To get from a1 to b2 takes 4 knight moves.To get from b2 to c3 takes 2 knight moves.To get from a1 to h8 takes 6 knight moves.To get from a1 to h7 takes 5 knight moves.To get from h8 to a1 takes 6 knight moves.To get from b1 to c3 takes 1 knight moves.To get from f6 to f6 takes 0 knight moves.
2014年04月13日 03点04分 1
1