RETO2M11 - 2RETO 11 MARATON
To perform work required to implement a program to build a square matrix of size N × N (where N is odd). You are given the value of N.
This matrix should be filled with the numbers 10, 11, 12, 13 and so on, starting from the central cell and following the path shown in the figure below.
→ | → | → | → | → |
↑ | → | → | → | ↓ |
↑ | ↑ | → | ↓ | ↓ |
↑ | ↑ | ← | ← | ↓ |
↑ | ← | ← | ← | ← |
Input
The size of the matrix, an odd integer.
Output
Matrix with numbers starting in 10, starting from the central cell by following the path defined.
Example
Input: 3 Output: 16 17 18 15 10 11 14 13 12
Input: 7 Output: 52 53 54 55 56 57 58 51 30 31 32 33 34 35 50 29 16 17 18 19 36 49 28 15 10 11 20 37 48 27 14 13 12 21 38 47 26 25 24 23 22 39 46 45 44 43 42 41 40
Added by: | MARATON AFDM |
Date: | 2015-09-28 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |