672 - I2P2014_Yang_補考1 Scoreboard

Time

2014/12/25 13:40:00 2014/12/25 15:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10154 Lab_4

10154 - Lab_4   

Description

Given a N x N board and a coordinate of point S, (x, y), you need to compute the shortest distance between each grid on the board and the point S.
The shortest distance only counts horizontal and vertical steps. The distance between one grid and the neighbor one is 1.

Input

Each testcase has two lines. The first line has N(3<=N<=7), which means the size of the board. The total number of grids on the board would be N x N.

The second line has two numbers, x and y(1<=x, y<=N), which mean the coordinate of the point S. x is the row index, and y is column index.
Note that (1, 1) is on the most top-left of the board.

Output

Print out the board, where the element of each grid is the shortest distance from the point S.

The element of point S is 0.
Note that you have to use "%3d" to print the output, and there is a ' \n ' at the last line.
 

Sample Input  Download

Sample Output  Download

Tags




Discuss