Spiral
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Consider all positive integers written in the following manner (you can imagine an infinite spiral).
Your task is to determine the position (row,column) of a given number N, assuming that the center (number 1) has position (0,0). Rows are numbered from top to bottom, columns are numbered from left to right (for example, number 3 is at (1,1). Your program should output a string containing the position of N in the form (R,C) where R is the row and C is the column. R and C must not contain any leading zeroes.
Input
The first line of the input gives an integer T, which is the number of test cases. Each test case contains an integer N (1 ≤ N < 2^31).
Output
For each test case, output the position as described above. See sample output for further clarification.
Examples
Input #1
Answer #1
Submissions 24
Acceptance rate 38%