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

PROGRAMMING:The same row diagonal lattice

Luz5年前 (2021-05-10)题库425
###Task description
```
Input three natural numbers n, I, J (1 < = I < = n, 1 < = J < = n), output in an n * n Lattice chessboard (the rows and columns are numbered from 1), and the positions of all the grids in the same row, the same column, and the same diagonal with the grid (I, J).
For example: n = 4, I = 2, j = 3 represent the lattice of the second row and third column in the chessboard, as shown in the following figure:
```
![ 1111.png](~/b7428cb1-5932-47eb-9863-457d5159b4ed.png)
```
When n = 4, I = 2, j = 3, the output result is:
(2,1) (2,2) (2,3) (2,4) the position of the lattice on the same row
(1,3) (2,3) (3,3) (4,3) the position of the lattice on the same column
(1,2) (2,3) (3,4) the position of the lattice on the diagonal from the upper left to the lower right
(4,1) (3,2) (2,3) (1,4) the position of the lattice on the diagonal from the bottom left to the top right
```
###Input format:
One line, three natural numbers n, I, J, separated by a single space between two adjacent numbers. 1 <= N <= 10。
###Output format:
Four lines:
The first line: output the same grid position from left to right;
The second line: output the same column grid position from top to bottom;
The third line: output the same diagonal grid position from top left to bottom right;
The fourth line: output the same diagonal grid position from bottom left to top right.
Each grid position is output in the following format: (x, y), where x is the line number and Y is the column number, with English punctuation and no space in the middle.
Two adjacent grid positions are separated by a single space.
###Input example:
```in
4 2 3
```
###Output example:
```out
(2,1) (2,2) (2,3) (2,4)
(1,3) (2,3) (3,3) (4,3)
(1,2) (2,3) (3,4)
(4,1) (3,2) (2,3) (1,4)
```
###Title Source
The second question of the popularization group in the second round of noip 1996
This topic is selected from openjudge website http://noi.openjudge.cn/ch0108/02/






answer:If there is no answer, please comment