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

建议使用的浏览器:

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

3004:The Chess

题目描述
Mr Li likes playing chess very much. One day he made a simplified version of the game. The chess board is relatively smaller. He will first place only three kinds of chesses on his own behalf, namely the Chariot("ju"), the Horse("ma") and the Cannon("pao"). Then he placed some chesses on the opposite's behalf. There will be one and only one chess of the opposite marked as the General("shuai"). Mr Li wants to kill the General as soon as possible without killing other chesses.
All chesses will move in the same way as in real chess games(The chinese chess).
To make the game easier, the opposite's chesses will stand still.
输入解释
For each test case,the first line contains two integers n and m(2<=n,m<=10) indicating the size of the borad. The next n lines, containing m characters each, describe the board. 'C', 'M' and 'P' stand for the Chariot, the Horse and the Cannon on Mr Li's behalf. 'S' stands for the General of the opposite while 'D' stands for other chesses. Cells marked as '.' are empty.
Process to the end of file.
输出解释
For each test case, first print a line saying "Scenario #k", where k is the number of the test case.Then,if Mr Li can kill the General, print the least number of steps needed. Otherwise print the sentence "OH!That's impossible!".Print a blank line after each test case, even after the last one.
输入样例
5 5
..DSD
...D.
C....
P.D..
...M.
7 7
.DDSDD.
..DDD..
...D...
.....P.
.C.....
...M...
.......
输出样例
Scenario #1
2

Scenario #2
OH!That's impossible!
来自杭电HDUOJ的附加信息
Recommend gaojie

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

源链接: HDU-3004

最后修改于 2020-10-25T22:59:07+00:00 由爬虫自动更新

共提交 0

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