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

建议使用的浏览器:

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

6210:King's Visit

题目描述
In chess, a king can move horizontally, vertically or diagonally to an adjacent cell in each move.
You are given an $8\times 8$ board with some obstacles. The starting position of the king is also given. Your task is to calculate the maximum number of cells that the king can visit, such that:
1.The king never moves to an obstacle.
2.Each cell are visited at most once (the starting position has already been visited at the beginning).
输入解释
The first line is the number of test cases. For each test case, there are $8$ lines and each line contains $8$ characters, in which the letter 'K' is the starting position, a letter 'O' is an obstacle and a '.' is an empty cell. There is an empty line after each test case.
输出解释
For each test case, output a line containing an integer, which is the maximum number of cells that the king can visit.
输入样例
2
.O....O.
O......O
........
...K....
........
........
O......O
.O....O.

.O....O.
O...OOO.
......O.
......O.
.O....O.
.O....O.
OOOOOO..
.......K
输出样例
53
33
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6210

最后修改于 2020-10-25T23:29:21+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/2000MS(Java/Others) 65535/32768K(Java/Others)