CF3A.Shortest path of the king
入门
通过率:0%
时间限制:1.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, because he has business of national importance. For example, he has to pay an official visit to square t. As the king is not in habit of wasting his time, he wants to get from his current position s to square t in the least number of moves. Help him to do this.

In one move the king can get to the square that has a common side or a common vertex with the square the king is currently in (generally there are 8 different squares he can move to).
国王独自留在棋盘上。尽管如此孤独,他并未灰心,因为他肩负着国家大事。例如,他需要正式访问目标格子 t。由于国王素来不浪费时间,他希望从当前位置 s 出发,以最少的步数抵达目标格子 t。请帮助他实现这一目标。

每一步中,国王可以移动到与其当前所在格子具有公共边或公共顶点的任意一个格子(通常共有 8 个不同的可移动格子)。
输入格式
The first line contains the chessboard coordinates of square s, the second line — of square t.
Chessboard coordinates consist of two characters, the first one is a lowercase Latin letter (from a to h), the second one is a digit from 1 to 8.
第一行包含方格 s 的棋盘坐标,第二行包含方格 t 的棋盘坐标。
棋盘坐标由两个字符组成:第一个字符为小写拉丁字母(从 a 到 h),第二个字符为数字(从 1 到 8)。
输出格式
In the first line print n — minimum number of the king's moves. Then in n lines print the moves themselves. Each move is described with one of the 8: L, R, U, D, LU, LD, RU or RD.
L, R, U, D stand respectively for moves left, right, up and down (according to the picture), and 2-letter combinations stand for diagonal moves. If the answer is not unique, print any of them.
第一行输出 n —— 国王所需的最少移动步数。随后的 n 行中,每行输出一次移动操作。每次移动用以下 8 种之一表示:L、R、U、D、LU、LD、RU 或 RD。
其中,L、R、U、D 分别表示向左、向右、向上、向下移动(依据图示),而两个字母的组合则表示对角线方向的移动。若答案不唯一,输出任意一种即可。
输入输出样例
输入#1
a8 h1
输出#1
7 RD RD RD RD RD RD RD
输入解题思路,AI测评打分。不知道怎么写?