HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


50468 - Draw Matrix - 2

Section problems

• 51119 - Evaluating Prefix expressions
• 50563 - Long Modulus
• 50594 - Transformations
• 51182 - Count and Sum 2
• 51193 - The max element of k-th co...
• 51194 - The difference between max...
• 51196 - The sum of two arrays
• 51197 - Even and odd Numbers
• 50468 - Draw Matrix - 2
• 50423 - Numbers square
• 50344 - Profit or Loss
• 50445 - Cryptography
• 50410 - Zero Padding
• 50380 - Sum of the Numbers in the ...
• 50300 - Matrix
• 50611 - Maximum of the minima
• 50616 - Snake

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