0 人解决,4 人已尝试。
0 份提交通过,共有 19 份提交。
9.9 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
The cows have taken up the game of checkers with a vengeance.Unfortunately, despite their infinite enjoyment of playing, they are terrible at the endgame. They want your help.
Given an NxN (4 <= N <= 30) checkboard, determine the optimal set of moves to end the game on the next move. Checkers move only on the ‘+’ squares and capture by jumping ‘over’ an opponent’s piece. The piece is removed as soon as it is jumped. See the example below
where N=8:
o - o - + - +
o - + - + - + King to jump successively across all three of the
marked as >K<):
Original
o - o - + - +
o - + - + - +
->K<- + - K -
After move 1
o - o - + - +
K<- K - + - + -
After move 2
->K<- + - + -
After move 3
The moves traversed these squares:
1 2 3 4 5 6 7 8 R C
1 - + - + - + - + start: 8 3
2 + - + - + - + - move: 6 1
3 - + - K - + - + move: 4 3
4 + - * - + - + - move: 6 5
5 - o - o - + - +
6 * - K - * - + -
7 - o - + - + - +
8 + - K - + - K -
Write a program to determine the (unique, as it turns out) game-ending sequence for an NxN input board if it exists. There is at least a king and at least one opponent piece on the board.
Line 1: A single integer: N
Lines 2..N+1: Line i+1 contains N characters (each one of: ‘-‘, ‘+’,
‘K’, or ‘o’) that represent row i of a proper checkboard.
“impossible” on a line by itself. If such a sequence exist,
each line contains two space-separated integers that represent
successive locations of a king whose moves will win the game.
8 -+-+-+-+ +-+-+-+- -+-K-+-+ +-+-+-+- -o-o-+-+ +-K-+-+- -o-+-+-+ +-K-+-K-
8 3 6 1 4 3 6 5
0 人解决,4 人已尝试。
0 份提交通过,共有 19 份提交。
9.9 EMB 奖励。