#K85337. Largest K Natural Sum
Largest K Natural Sum
Largest K Natural Sum
You are given an integer n. Your task is to determine the largest integer k such that the sum of the first k natural numbers is less than or equal to n. Mathematically, you need to find the maximum integer k satisfying
$$\frac{k(k+1)}{2} \le n$$
This problem will be provided in multiple test cases. For each test case, output k in a new line.
inputFormat
The first line of input contains a single integer T (the number of test cases). Each of the following T lines contains a single integer n for that test case.
Example:
5 10 20 1 15 21
outputFormat
For each test case, output a single line containing the largest integer k such that the sum of the first k natural numbers is less than or equal to n.
Example:
4 5 1 5 6## sample
5
10
20
1
15
21
4
5
1
5
6
</p>