Program | CROSSWORD.C CROSSWORD.PAS CROSSWORD.CPP |
From the matrix a crossword diagram can be drawn. In the diagram each square is represented by a box 4x6 characters. Black square and white squares (numbered and not numbered square) are represented as follows (where nnn is the number of the square):
++++++ ++++++ ++++++
++++++ +nnn + + +
++++++ + + + +
++++++ ++++++ ++++++The remaining characters of the box are spaces. If black squares are given at the edges, they should be removed from the diagram (see the example). Only use spaces as necessary filling characters. Don't use any unnecessary spaces at the end of the line.
Sample Input
6 7
1 0 0 0 0 1 1
0 0 1 0 0 0 0
0 0 0 0 1 0 0
0 1 0 0 1 1 1
0 0 0 1 0 0 0
1 0 0 0 0 0 1
5 3
1 0 1
0 0 0
1 1 1
0 0 0
1 0 1
0 0
Sample Output
+++++++++++++++++++++
+001 + +002 +003 +
+ + + + +
++++++++++++++++++++++++++++++++++++
+004 + ++++++005 + +006 +007 +
+ + ++++++ + + + +
++++++++++++++++++++++++++++++++++++
+008 + +009 + + +010 + +
+ + + + + + + +
+++++++++++++++++++++ +++++++++++
+ ++++++011 + +
+ ++++++ + +
++++++++++++++++++++++++++++++++++++
+012 +013 + ++++++014 +015 + +
+ + + ++++++ + + +
++++++++++++++++++++++++++++++++++++
+016 + + + + +
+ + + + + +
++++++++++++++++++++++++++
--------------------------------------------------
++++++
+001 +
+ +
++++++++++++++++
+002 + + +
+ + + +
++++++++++++++++
++++++++++++++++
+003 +004 + +
+ + + +
++++++++++++++++
+ +
+ +
++++++