Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: MegaCheckers
Description MegaCheckers is a board game for two players, very similar to the known game of Checkers. The board is rectangular, with At the beginning of the game, each player has a certain number of pieces, placed in homes closest to the edge of the board the player chooses (the players choose opposite edges). During the game, the pieces can only occupy the homes of the board. One of the moves of the game is to “capture” an opponent’s piece, jumping over it, diagonally, to an adjacent home beyond the piece, which should be empty. The opponent’s piece is then removed from the board. The three homes involved in the capture (the initial home of your piece, the home that holds the opponent’s piece and the empty home, where your piece will be after the play) must be diagonally aligned and diagonally adjacent, as in the figure below.
In MegaCheckers a piece can capture the opponent’s pieces jumping diagonally forward or backward (note that, in the majority of existent variants of the game of checkers, a piece can only capture opponent pieces jumping forward). You can also trigger a multiple capture, with just one piece, jumping successively to empty homes over opponent pieces. In a multiple capture, your piece can change direction, jumping in one direction and later in another one. You can capture only one piece each jump, but can capture several pieces with successive jumps. You can’t jump over a piece of yours, or jump over the same opponent piece more than once. The dimensions of the board and a description of the current state of a game are given. It’s your turn to play and you should determine of maximum number of your opponent’s pieces that can be captured in one capture move. Input The input contains several test cases. The first line of a test case contains two integers
Figure 1: Numeration of homes on (a) board of dimensions 8 × 8 and on (b) board of dimensions 5 × 3. Output For each test case, your program should produce one line of output, containing an integer indicating the largest number of pieces of your opponent’s that can be captured in one move. Sample Input 3 3 2 1 2 0 1 5 3 1 0 2 1 0 2 0 0 8 8 2 2 2 2 0 0 0 0 2 2 2 2 0 0 0 0 2 2 2 2 0 0 0 0 2 2 2 2 0 1 0 0 0 0 Sample Output 1 2 7 Source South America 2006, Brazil Subregion |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator