HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50468 - Draw Matrix - 2

Guest
• Review clarifications (1)

Volume problems

• 50865 - Apartment Building Adminis...
• 50531 - File Decryption
• 50525 - Ordering Pizza
• 50451 - Processing Cost
• 50470 - Close Pairs - Revised
• 50752 - Student Groups
• 50524 - Elevator
• 50751 - The biggest Minute
• 50468 - Draw Matrix - 2
• 50998 - CEN112 Homework, quiz av...
• 50804 - Marathon
• 50835 - Club Presidency
• 50526 - Gold Market
• 50872 - Top M Grades
• 50868 - Sort Frequencies
• 50405 - Accounts Receivable
• 50377 - kth Permutation

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 Ibrahim Mesecan.

Draw Matrix - 2

Given an nxn matrix fill the matrix in such a way that the upper left corner is one. And that is surrounded by zeros. And the zeros are surrounded by ones again. This continues until the matrix size n.

Question: Write a program that is going to fill the matrix with ones and zeros starting from upper left corner.

Input specification
You will be given an integer number (n) the size of square matrix where 1 ≤ n ≤ 20.

Output specification
Show the square matrix with ones and zeros.

 Sample Input   
  4
 Sample Output   
  0 1 0 1
  0 1 0 0
  0 1 1 1
  0 0 0 0

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

www.contester.ru