codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

710C.md (675B)


      1 Source: https://codeforces.com/problemset/problem/710/C
      2 
      3 C. Magic Odd Square
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Find an *n* × *n* matrix with different numbers from 1 to *n*2, so the sum in each row, column and both main diagonals are odd.
     22 
     23 Input
     24 
     25 The only line contains odd integer *n* (1 ≤ *n* ≤ 49).
     26 
     27 Output
     28 
     29 Print *n* lines with *n* integers. All the integers should be different and from 1 to *n*2. The sum in each row, column and both main diagonals should be odd.
     30 
     31 Examples
     32 
     33 Input
     34 
     35 ```
     36 1
     37 ```
     38 
     39 Output
     40 
     41 ```
     42 1
     43 ```
     44 
     45 Input
     46 
     47 ```
     48 3
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 2 1 4  
     55 3 5 7  
     56 6 9 8
     57 ```