-->
当前位置:首页 > 题库

PROGRAMMING:Vault problem

Luz5年前 (2021-05-10)题库366
Given the m * n (Mn < = 100) chessboard and the point coordinates (1,1) in the upper left corner, a horse starts from point (1,2) to jump all the points on the chessboard along the Japanese font (there are eight kinds), and each point can only jump once. The corresponding coordinate offsets of the preferred direction when a horse takes off from point (x, y) are: {2,1}, {1,2}, {- 1,2}, {- 2,1}, {- 2, - 1}, {- 1, - 2}, {- 1}, {- 2, - 1}. Some chessboards have many kinds of jumping methods. Now I am more interested in what is the k-th jumping method of the horse?
###Input format:
Three integers m, N, K in a row.
###Output format:
Output the k-th jump method of the horse. If the horse can't jump all the points on the chessboard, output impossible. If there are less than k jump methods, output the last jump method.
###Input example:
Here is a set of inputs. For example:
```in
4 4 1
```
```in
4 5 6
```
###Output example:
The corresponding output is given here. For example:
```out
impossible
```
```out
20 1 16 9 12
15 8 11 4 17
2 19 6 13 10
7 14 3 18 5
```
Note: in the matrix, integers 1 ~ m * n represent the position of the horse in turn,; For example, 1 is in the first row and the second column, indicating the starting position of the horse, and the next step is in the third row and the first column corresponding to the integer 2< br>





answer:If there is no answer, please comment