#T545. 同行列对角线的格
同行列对角线的格
Description
Input three natural numbers (, ), and output the positions of all squares in an chessboard (where rows and columns are numbered starting from 1) that are in the same row, same column, or same diagonal as the square .
For example: When , , , it represents the square in the second row and third column of the chessboard.
When , , , the output is:
(2,1) (2,2) (2,3) (2,4) Positions of squares in the same row
(1,3) (2,3) (3,3) (4,3) Positions of squares in the same column
(1,2) (2,3) (3,4) Positions of squares on the top-left to bottom-right diagonal
(4,1) (3,2) (2,3) (1,4) Positions of squares on the bottom-left to top-right diagonal
Input Format
One line containing three natural numbers , , , separated by single spaces ().
Output Format
First line: Output the positions of squares in the same row from left to right;
Second line: Output the positions of squares in the same column from top to bottom;
Third line: Output the positions of squares on the top-left to bottom-right diagonal;
Fourth line: Output the positions of squares on the bottom-left to top-right diagonal.
Each square position should be formatted as: , where is the row number and is the column number, using English punctuation with no spaces in between. Separate adjacent square positions with a single space.
4 2 3
(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)
源码
CodesOnline