CPTTRN7 - Character Patterns (Act 7)

Print a regular grid pattern with diamond-like base elements. Use the \ (backslash) and the / (slash) characters to print diamonds and . (dots) to fill the rest of the space.

Input

You are given t - the number of test cases and for each of the test cases three positive integers: r - the number of rows, c - the number of columns in the grid and s - the size of each diamond.

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
2022-05-22 15:36:36 Mostafa 36a2
There is some input lines have extra spaces, be aware of trailing spaces or extra spaces in input.
Causes me lots of NZEC, because I'm using python input() function
2021-04-22 16:52:58
All of these Character Pattern problems are loops, loops, loops.

Last edit: 2021-04-22 17:22:08
2020-04-29 11:23:04
How can I solve this
2020-01-22 18:47:18
couldn't believe I solved this , the order in which basic problems is given is just great !!
2018-08-12 16:43:30
misunderstand the 's' before. But it's AC now.

Last edit: 2018-08-15 17:31:02
2017-11-07 09:04:06 Lionel Messi
I overcome the TLE for this problem by using StringBuilder. More details here: https://stackoverflow.com/questions/11823095/whats-the-fastest-way-to-output-a-string-to-system-out

Last edit: 2017-11-07 16:01:38
2017-11-07 00:00:26
"if (abs(i - j) % s == s / 2)" for \
and "if ((i + j) % s == r) with r = (s / 2 + 1) % s" for /
2017-05-27 13:49:45
I also had problems with TLE in Java, it worked when I replaced System.out.println with custom buffered output
2017-05-19 05:13:38
Me too, my solution is also time exceeded error, but the complexity has already been O(n), I just walk throught every point once.
2017-04-30 13:15:26
Hi, I am able to run it on my local with average time of 0.0532 sec and also in ideone its working within time limit specified in problem desc , but still getting TLE .Here is my solution : <snip>

Last edit: 2023-02-07 16:41:02
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.