编程介的小学生 2017-06-04 16:12 采纳率: 20.5%
浏览 820
已采纳

One-move Checkmate

The chess endgame "a king and a queen versus a king" is known to be easy victory for the side that has a queen.

The position in such an endgame is described by the locations of three figures: the white king, the white queen, and the black king. Locations are written in a usual chess notation, constructed from a letter from "a" to "h", which determine vertical line, and the digit from 1 to 8, which determine horizontal line of the location.

Given the position described, you are find a move for the white queen by which the black king will be checkmated, or determine that no such a move exists.

Input

The input file contains three two-character locations for the white king, white queen, and black king, in that order, separated by spaces.

The input position is a valid chess position for the white's turn, i.e. all figures occupy different spaces, kings are not located in the neighboring squares, and the black king is not under the check.

Process to the end of file.

Output

Output file must contain the two-character location - destination square for the white queen's move. If checkmating move does not exist, output file must contain the string "no". If there is more than one checkmating move, you may output any one of them.

Sample Input

a3 g2 a1

Sample Output

a2

  • 写回答

1条回答 默认 最新

  • devmiao 2017-06-04 18:32
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号