CPTTRN5 - Character Patterns (Act 5)
Using two characters: . (dot) and * (asterisk) print a grid-like pattern. The grid will have l lines, c columns, and each square shaped element of the grid will have the height and width equal to s.
Moreover, each of the grid elements will have a diagonal. The diagonal of the first square in the first line of the grid is directed towards down and right corner - use the \ (backslash) character to print it; while the next diagonal will be directed towards upper right corner - use the / (slash) character to print it. Print the successive diagonals alternately (please consult the example below).
Input
You are given t - the number of test cases and for each of the test case three positive integers: l - the number of lines, c - the number of columns in the grid and s - the size of the single square shaped element.
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 4 4 1 2 5 2 Output: **** *\.* *.\* **** *./* */.* **** *\.* *.\* **** ********* *\*/*\*/* ********* */*\*/*\* ********* *\*/*\*/* ********* */*\*/*\* ********* **************** *\.*./*\.*./*\.* *.\*/.*.\*/.*.\* **************** *./*\.*./*\.*./* */.*.\*/.*.\*/.* ****************
hide comments
manoj_goud:
2021-10-13 11:09:37
this is hard for me : (
|
|
b4u3n2n1y:
2021-04-22 16:51:39
I'm doing CPTTRN7 and CPTTRN8 before doing this one! |
|
nullius_in7:
2020-03-26 18:55:32
Divide it into the 4 sections (even and odd by row, and even and odd by column) That really helped me |
|
mano_sriram:
2019-07-07 18:18:58
Can s be greater than l ?? |
|
oinon27:
2018-04-20 18:11:31
Why "wrong answer" when my program give the same answer as example???
|
|
masterchef2209:
2018-03-17 17:02:37
this is a tricky one Last edit: 2018-03-17 17:03:11 |
|
saloni1912:
2017-12-18 12:24:47
My solution runs well on ideone but I am getting wrong answer here on spoj. Please can you give me the solution?
|
|
mananj02:
2017-09-27 19:42:14
hint - for slashes think of property of diagonals of a square. |
|
mananj02:
2017-09-27 19:41:20
I thought it will be hard for me to solve it but, when I read the question I did it in not more than 10 mins. |
|
codehungry95:
2017-09-17 09:16:04
Finally :D
|
Added by: | kuszi |
Date: | 2012-09-04 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |