Spiral
Numbers from 1 to N2 recorded in a square matrix of NxN in a spiral starting from the top left cell in a clockwise direction, as shown in the figure. Find a number which is located in the i-th row and j-th column.
Specifications
Input
In the input file the natural numbers N, i, j (1 ≤ i, j ≤ N ≤ 100).
Output
The output file you want to record the number that has the coordinates of i, j.
Problem information
Time Limit: 1 secondsMemory Limit: 64 MB
Balls for the passed test: 10
Complexity: 10% 265/295
Example
Example input5 4 2 |
Example output23 |
| ← Transfer | Problems | Waterpipe - 2 → |
