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

建议使用的浏览器:

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

5897:The Game

题目描述
Alice and Bob like playing Chinese Chess. One day they are playing a game: Alice has a General, Bob has a General and a Horse, they both obey the rules of Chinese Chess, which are:

$\bullet $ General has 4 moving directions, Horse has 8 moving directions, but they can't move out of the chess board or their own moving areas. See the picture to get more details:



$\bullet $ In some circumstances, Horse can't move to all his positions, just as you can see in the picture, it can move to the black positions, but can't move to the red positions:



$\bullet $ Two Generals can eat each other if and only if they have the same y-coordinate and Horse is not between them.
(For more information, click http://https://en.wikipedia.org/wiki/Xiangqi)

One is considered to be the winner only when his enemy's General is eaten. Please note that if the game is a tie, Alice is considered to be the winner. If Alice know that she has no chance to win the game at the beginning, she will take the strategy to make the game last more steps. If Alice can't win, Bob want to end the game as soon as possible.

If Alice win the game, output "Lucky guy!", else output "Lose in x steps T.T!", x indicates the number of steps they take (the sum of Alice's and Bob's steps). Suppose they all make best strategies.
输入解释
7 numbers $x_1,y_1,x_2,y_2,x_3,y_3,p$, where:

$\bullet $ $(x_1,y_1)$indicates the coordinate of the Bob's Horse $(0 \leq x_1 \leq 9, 0 \leq y_1 \leq 8)$;
$\bullet $ $(x_2,y_2)$indicates the coordinate of the Bob's General $(7 \leq x_2 \leq 9, 3 \leq y_2 \leq 5)$;
$\bullet $ $(x_3,y_3)$indicates the coordinate of the Alice's General $(0 \leq x_3 \leq 3, 3 \leq y_3 \leq 5)$;

$\bullet $ $p$ indicates the people who moves first, 0 for Alice, 1 for Bob.
输出解释
If Alice win, output "Lucky guy!" (without quotations), else output “Lose in x steps T.T!”, x indicates the number of steps they take (the sum of Alice's and Bob's steps).
输入样例
5
0 0 9 3 0 3 0
2 6 9 5 2 3 1
0 4 7 3 1 4 0
3 2 7 4 1 3 0
3 2 7 4 1 3 1 
输出样例
Lucky guy!
Lose in 3 steps T.T!
Lucky guy!
Lose in 4 steps T.T!
Lose in 1 steps T.T!

提示
In sample 1, Alice moves first, she can eat Bob's General directly;
In sample 2, Bob move his Horse to $(0,5)$, then wherever Alice move her General, it will be eaten by Bob's Horse, so they take 3 steps in total.
来自杭电HDUOJ的附加信息
Recommend wange2014

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

源链接: HDU-5897

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

共提交 0

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