SPTTRN4 - Straight Line Spiral Pattern (Act 4)
For this problem we consider spirals drawn as ASCII Art pictures using only the * and . character in an s by s grid. We call s the size of the spiral. Here are example of such spirals for some values of s.
The spiral of size s=3
*.*
*.*
***
The spiral of size s=4
*.**
*..*
*..*
****
The spiral of size s=5
*.***
*.*.*
*.*.*
*...*
*****
The spiral of size s=6
*.****
*.*..*
*.*..*
*.**.*
*....*
******
The spiral of size s=7
*.*****
*.*...*
*.*.*.*
*.*.*.*
*.***.*
*.....*
*******
The spiral of size s=8
*.******
*.*....*
*.*.**.*
*.*..*.*
*.*..*.*
*.****.*
*......*
********
The spiral of size s=9
*.*******
*.*.....*
*.*.***.*
*.*.*.*.*
*.*.*.*.*
*.*...*.*
*.*****.*
*.......*
*********
Input
The first line contains an integer T=1000, which is the number of test cases. Then the next T lines contain 3 integers separated by a single space, namely 3≤s≤10000, 1≤i≤s and 1≤j≤s.
Output
For each test case output in a single line the character of the spiral of size s at row i and at column j.
Example
Input: 3
3 1 1
4 3 2
5 2 3 Output: *
.
*
Added by: | xtof |
Date: | 2016-10-06 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU |