#P1259. 黑白棋子的移动

黑白棋子的移动

Description

There are 2n2n pieces arranged in a row. Initially, all white pieces are on the left and all black pieces are on the right. The following figure shows the case n=5n=5.

The rules for moving the pieces are as follows: in each move, you must move two adjacent pieces simultaneously, regardless of their colors. They may move left or right into empty positions, but their left–right order cannot be swapped. Each move must jump over one or more pieces (you cannot simply slide). The goal is to obtain a row of pieces alternating in color. For example, when n=5n=5, the target becomes:

Task: write a program to print the whole sequence of moves.

Description

Input Format

A single integer nn.

Output Format

Multiple lines, showing the initial state and the state after each move. Use 'o' to denote a white piece, '*' to denote a black piece, and '-' to denote an empty cell.

7
ooooooo*******--
oooooo--******o*
oooooo******--o*
ooooo--*****o*o*
ooooo*****--o*o*
oooo--****o*o*o*
oooo****--o*o*o*
ooo--***o*o*o*o*
ooo*o**--*o*o*o*
o--*o**oo*o*o*o*
o*o*o*--o*o*o*o*
--o*o*o*o*o*o*o*

Hint

Constraints: 4n1004 \leq n \leq 100.

Translated by ChatGPT 5