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

/\/\/\/\
\/\/\/\/
/\/\/\/\
\/\/\/\/
/\/\/\/\
\/\/\/\/
/\/\/\/\
\/\/\/\/


./\../\../\../\../\.
/..\/..\/..\/..\/..\
\../\../\../\../\../
.\/..\/..\/..\/..\/.
./\../\../\../\../\.
/..\/..\/..\/..\/..\
\../\../\../\../\../
.\/..\/..\/..\/..\/.

hide comments
caosyhailong99: 2018-08-12 16:43:30

misunderstand the 's' before. But it's AC now.

Last edit: 2018-08-15 17:31:02
Lionel Messi: 2017-11-07 09:04:06

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
tranxuanbach: 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 /

bisker: 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

sun_tail: 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.

mohit_spoj: 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 : http://ideone.com/7K4kUE

vastu_99: 2016-09-11 21:04:09

i dont know the exact solution for this from where can i find it?

saro95: 2016-07-25 21:36:07

magic happens with (i+j) and abs values.

tejasytl: 2016-06-23 11:30:17

What does the size of diamond mean here?

udayraj_123: 2016-06-13 20:55:59

There are 2 line breaks after pattern for 4 4 1. Is that correct output ?
also, what is the correct output for 2 3 3

Last edit: 2016-06-13 21:10:41

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