当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1647: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.
输入解释
The input 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.
输出解释
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, output the one with the smallest vertical position then with the smallest horizontal postion.
输入样例
a3 g2 a1
输出样例
a2
提示
Move rules:
The queen may move in any straight line, horizontal, vertical, or diagonal.
The king moves one square in any direction, horizontally, vertically, or diagonally.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-1647

最后修改于 2020-10-29T06:09:56+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536