HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


120. 50329 - Draw Matrix-1

Guest
• Discussion of problem (1)

Volume problems

• Problem 3
• 50468 - Draw Matrix - 2
• 010. 50381 - Sum of the numbers
• 030. 50737 - Sum of the k-largest n...
• 060. 50389 - Reverse an Array
• 100. 50330 - Find the average of n ...
• 110. 50359 - Mode of a Series
• 120. 50331 - Number of Numbers o...
• 120. 50329 - Draw Matrix-1
• 125. 50538 - Sum of kth Diagonal
• 140. 50599 - Sum of Squared Error ...
• 15-SprPrE1-80. 50741 - DNA Distance
• 151. 50557 - nth Power of m (Long...
• 155. 50334 - What is the class aver...
• 155. 50726 - Pascal Triangle - 1
• 160. 50301 - Fractions to Decimals
• 165. 50360 - National Elections

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.
Prepared by Ibrahim Mesecan. Difficulty Beta

DRAW MATRIX 1

Write a program that asks for a number n and then draws n*n matrice which is completely filled with ones and zeros like this:
Sample Run 1:
n-->3 // the number we get from the input file is 3
1 1 1
1 0 1
1 1 1

Input specification
There is just one number (n) in the input file showing the size of matrix. 1 ≤ n ≤ 20.

Output specification
The outer most square will be filled with ones. Then, every inner line with zeros and ones following each other.
Give a space after every digit.
Sample Run2:
n-->5 // the number we get from the input file is 5
1 1 1 1 1
1 0 0 0 1
1 0 1 0 1
1 0 0 0 1
1 1 1 1 1

Sample Run3:
n-->6 // the number we get from the input file is 6
1 1 1 1 1 1
1 0 0 0 0 1
1 0 1 1 0 1
1 0 1 1 0 1
1 0 0 0 0 1
1 1 1 1 1 1

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

www.contester.ru