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

建议使用的浏览器:

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

1667:Peg Game

题目描述
You are given a 7-by-7 board of holes. Some holes are filled with pegs, and some are not. You may jump a peg over an adjacent peg, as long as the hole the jumping peg lands in is unoccupied. The jumped peg is removed. Your goal is to leave the board with only one peg in it, and the peg must end up in the specified location.
The board is specified as a 7-by-7 array of characters, with the following meanings:
x : this hole may never be occupied by a peg
e : this hole is initially empty
o : this hole is initially occupied by a peg
E : this hole is initially empty, and the last peg should end here
O : this hole is initially occupied, and the last peg should end here
For example, consider the following board:
x x e e e x x
x x o e e x x
e e o e e e e
e e o O e e e
e e e e e e e
x x e e e x x
x x e e e x x
You can see that there are initially 4 pegs in the board, and the last peg should end up in the middle of the board.
The winning sequence of moves is:
1. (4, 4) to (2, 4)
2. (3, 2) to (3, 4)
3. (2, 4) to (4, 4)
Where coordinates are given as (x, y).
输入解释
The first line of input is the number of datasets to follow. Each dataset should be processed the same.
The input for each dataset consists of 7 lines; each line consists of 7 characters from the set {x, e, o, E, O} with blanks between them. You are guaranteed that exactly one 'E' or 'O' will appear, and that two or more 'o' or 'O' will appear.
输出解释
For each dataset, output a line containing the data set number. If a sequence of valid moves exists that leaves only one peg on the board, and leaves that peg in the desired location, print out the sequence of moves, as shown in the above example. If no sequence exists, print 揘o solution". Leave a blank line between datasets.
输入样例
2
x x e e e x x
x x o e e x x
e e o e e e e
e e o O e e e
e e e e e e e
x x e e e x x
x x e e e x x
x x e E e e e
x e e e e e e
e e e o o e e
e e e x e e e
e e e e e e e
e e e e e e e
e e e e e e e
输出样例
Dataset 1:
1. (4, 4) to (2, 4)
2. (3, 2) to (3, 4)
3. (2, 4) to (4, 4)

Dataset 2:
No solution.
提示
Search order:up,left,down,right

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

题目来源 Greater New York 2003

源链接: POJ-1667

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

共提交 0

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