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
enkhtsolmon: 2016-04-15 02:49:43

solved if using python don't forget strip :D

enkhtsolmon: 2016-04-15 02:36:13

please help nzec

sirmokona: 2016-03-22 05:51:07

This is a tricky one, I couldn't get it to work with any of the tips above, I ended up using the following equivalence:
0 == (i+j) % (2*square_size+2) for the backslashes
and for the other ones try to figure it out ;)

pranshuchester: 2016-03-13 21:16:48

how to solve segmentation fault?

adi_tdkr: 2016-03-07 12:04:15

How to solve test case 3 any idea??

srishti77714: 2016-02-08 23:14:27

i tried solving this probem using a function that prints the basic square for the grid in every row and column, i am nearly done with this but the problem is that i am not able to move the cursor back to the start position after printing one square of a coloumn in say line 1 to print the second square for coloumn2 in line 1, can anybody help me with this . I am using c++.

gsstrholmes: 2016-02-08 05:52:19

help ?

imshubhamk: 2016-01-29 19:04:03

how to print \ in c++

abhi11095: 2016-01-27 08:03:26

Can anyone plz help me to provide some hint regarding this pattern

tarun_2608: 2016-01-18 14:21:41

@soaph,I haven't understood what you have said...can u pls elaborate!!!


Added by:kuszi
Date:2012-09-04
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64