#K41222. Closest Triangular Number
Closest Triangular Number
Closest Triangular Number
Given an integer \(N\), your task is to find the closest triangular number to \(N\). A triangular number is defined by the formula \(T_k = \frac{k(k+1)}{2}\) for a non-negative integer \(k\). If two triangular numbers are equally close to \(N\), output the smaller one.
The problem requires you to process multiple test cases; for each test case, compute and print the answer on a separate line.
inputFormat
The input is given from standard input and consists of multiple lines. The first line contains a single integer \(T\), representing the number of test cases. Each of the next \(T\) lines contains a single integer \(N\).
outputFormat
For each test case, output the closest triangular number on a separate line to standard output.
## sample2
10
20
10
21
</p>