#C11832. Maximum Pyramid Height
Maximum Pyramid Height
Maximum Pyramid Height
You are given a number of stones and need to build a pyramid. In this pyramid, the first level requires 1 stone, the second level requires 2 stones, the third level requires 3 stones, and so on. The objective is to calculate the maximum height \(h\) such that the total number of stones required \(1 + 2 + ... + h = \frac{h(h+1)}{2}\) does not exceed the given number of stones \(n\).
For example, if you have 6 stones, you can build a pyramid of height 3 because \(1 + 2 + 3 = 6\). If you have 10 stones, the maximum height is 4, since \(1 + 2 + 3 + 4 = 10\).
You will be given multiple test cases. For each test case, output the maximum pyramid height possible.
inputFormat
The input is provided via stdin and has the following format:
T n1 n2 ... nT
where T is the number of test cases, and each ni is a non-negative integer representing the total number of stones available for that test case.
outputFormat
For each test case, output the maximum number of complete levels in the pyramid that can be built using the available stones. Each result should be printed on a new line to stdout.
## sample1
1
1
</p>