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:
****
*\.*
*.\*
****
*./*
*/.*
****
*\.*
*.\*
****

*********
*\*/*\*/*
*********
*/*\*/*\*
*********
*\*/*\*/*
*********
*/*\*/*\*
*********

****************
*\.*./*\.*./*\.*
*.\*/.*.\*/.*.\*
****************
*./*\.*./*\.*./*
*/.*.\*/.*.\*/.*
****************

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
2015-12-23 12:23:48


You can reuse the pattern of *s of CPTTRN4, and with just 2 loops over i and j, distinguish the cases for / and \ depending on modulos of i+j or i-j

Last edit: 2015-12-23 12:26:47
2015-11-22 23:41:44 Micha³ Krokocki
Ok, I was trying to pass it for a few days, finally I made it! Tips? First try to make it work for two sizes of square - for 1 and for 2. If you make it, changing it to flexible version is easy.
2015-11-19 14:08:33
I just passed it, give you some tips.

i for row, j for column for bigger block; k for row, l for column of smaller block.

1. judge (i+j)&1 for '/' or '\'.
2. loop level i > k > j > l
2015-11-19 10:30:53 abhinaw tiwari
CPTTRN1, CPTTRN2, CPTTRN3, CPTTRN4 were easy. But I am finding CPTTRN5 a bit difficult. Can anyone help me out please?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.