Lab9 Chess Movement
You cannot submit for this problem because the homework's deadline is due.
#recursion
Description:
Provided \(2n\) chesses in a single line where \(n\) white chesses are on the left and \(n\) black chesses are on the right. There are two extra blank position on the right. For example, if we denote o
as white chess, *
as black chess and -
as blank position, we have the following condition when \(n=5\): ooooo*****--
.
Now you need to move the chess so as to let every black chess alternating with a white one. For example, when \(n=5\), your final chess board should look like: --o*o*o*o*o*
. However, you can only move two adjacent chess at a time.
Input: an integer \(n\) indicating the number of a kind of chess.
Output: m lines, each line indicating your movement of the chess. Note that you only need to output m lines with a feasible solution ~~of shortest step~~.
Sample #1
input
7
output
ooooooo*******--
oooooo--******o*
o--ooooo******o*
o**ooooo***--*o*
o**oo--o***oo*o*
o*--o*oo***oo*o*
o*o*o*o--**oo*o*
o*o*o*o*o*--o*o*
--o*o*o*o*o*o*o*
Mid2 Sample Exam
- Status
- Finished
- Problems
- 3
- Open Since
- 2020-07-10 13:00
- DDL
- 2020-07-12 23:59
- Extension
- 96.0 hour(s)