HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC-2014-15 Questions > problem:


3rd-4. 50406 - Draw Pattern 178

IMPC-2014-15 Questions

Start: Nov.22.2014 at 03:00:00 PM
Finish: Nov.22.2014 at 08:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 1st-6. 50485 - Center of gravity of ...
• 2nd-1. 50522 - Multiplication Table - 2
• 2nd-2. 50512 - Coding redundancy
• 2nd-3. 50533 - Contacts List
• 2nd-5. 50793 - Top M Customers
• 2nd-6. 50486 - Problems and Progr...
• 3rd-2. 50405 - Accounts Receivable
• 3rd-3. 50474 - Sum of Two Primes
• 3rd-4. 50406 - Draw Pattern 178
• 3rd-5. 50415 - The Scientist
• 3rd-6. 50695 - Longest link between...
• 4th-1. 50491 - Brokers
• 4th-2. 50524 - Elevator
• 4th-3. 50535 - Image Compression
• 4th-6. 50536 - Epoka Furgon Shpk
• Ind_01-10. 50752 - Student Groups
• Ind_01-20. 50416 - Placing Domino...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Renato Bala.

Draw Pattern 178

Your professor has asked several different pattern questions. And, he has many others waiting for you :) He wants you to draw a pattern as described below:

First you put 4 numbers to the corners of the square, Then you write 4 other numbers next to each corner until finish outer layer of the square. After you finish this layer, you go to the inner layer and you repeat.

Question:
Write a program that gets the size of the pattern and draws the pattern described above.

Input specification
You will be given just one integer number (n) where n is between 1 and 60.

Output specification
Show n2 integer numbers (separated by spaces) as described above.

Sample Input I
4
Sample Input II
5
Sample Output I
1 5 9 2
12 13 14 6
8 16 15 10
4 11 7 3
Sample Output II
1 5 9 13 2
16 17 21 18 6
12 24 25 22 10
8 20 23 19 14
4 15 11 7 3


Для отправки решений необходимо выполнить вход.

www.contester.ru