Submit | All submissions | Best solutions | Back to list |
CPTTRN6 - Character Patterns (Act 6) |
Given specified dimensions, print a grid-like pattern. Use the | (pipe) sign to print vertical elements, the - (minus) to print horizontal ones and + (plus) for crossings. The rest of the space fill with . (dots) characters.
Input
You are given t - the number of test cases and for each of the test cases four positive integers: l - the number of horizontal elements, c - the number of vertical elements in the grid; h and w - the high and the width of the single rectangle respectively.
Output
For each of the test cases output the requested pattern (please have a look at the example). Use one line break in between successive patterns.
Example
Input: 3 3 1 2 1 4 4 1 2 2 5 3 2 Output: .|. .|. -+- .|. .|. -+- .|. .|. -+- .|. .|. ..|..|..|..|.. --+--+--+--+-- ..|..|..|..|.. --+--+--+--+-- ..|..|..|..|.. --+--+--+--+-- ..|..|..|..|.. --+--+--+--+-- ..|..|..|..|.. ..|..|..|..|..|.. ..|..|..|..|..|.. ..|..|..|..|..|.. --+--+--+--+--+-- ..|..|..|..|..|.. ..|..|..|..|..|.. ..|..|..|..|..|.. --+--+--+--+--+-- ..|..|..|..|..|.. ..|..|..|..|..|.. ..|..|..|..|..|..
Added by: | kuszi |
Date: | 2012-09-04 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
2020-02-13 17:45:25
try to print only one grid and only one row and one column and finally both grid and column That's how i got ACCEPTED Last edit: 2020-02-13 17:48:11 |
|
2018-07-17 18:24:07
Are there any tutorials explaining how the code really works and why it is this way, to understand and learn how to build one of these programs in the future? Right now I am just writing from whomever wrote it before me and trying to learn, but its hard! |
|
2017-09-02 10:08:56
Start with 1 not 0. I solved it at the first go.. |
|
2017-06-12 09:59:26
Those having problem understanding the statement-height means no of consecutive vertical elements,width means no of consecutive horizontal elements. Last edit: 2017-06-12 10:00:13 |
|
2017-03-17 08:50:50
use "for" function for each line and column. then add the last line and column without for. |
|
2017-03-11 03:19:36
Things get easier once you figure out what L and C really mean and how they map to the pattern. |
|
2016-06-23 07:24:04
For others who may be confused, the "elements" are the lines, not the spaces. It seems like a no-brainer, but it took me like 10 minutes to realize that. |
|
2016-06-19 11:29:12
AC!! in first go...like butter :D |
|
2016-04-30 05:43:17 Dennis Slater
If you have done Character Patterns 1-5 this one is very easy. Accepted first try using C#. 0.00 seconds. |