#K86782. Maximum Complete Marble Piles
Maximum Complete Marble Piles
Maximum Complete Marble Piles
Given a total number of marbles, determine the maximum number of complete piles that can be formed. In a complete pile, the first pile contains 1 marble, the second contains 2 marbles, the third contains 3 marbles, and so on. A pile is considered complete if the total number of marbles in the pile is exactly equal to its corresponding count. The problem reduces to finding the largest integer \(k\) such that
[ \frac{k(k+1)}{2} \le n ]
for a given number of marbles \(n\). You are given multiple test cases.
inputFormat
The first line of the input contains an integer \(T\) \( (1 \le T \le 10^5)\), representing the number of test cases. Each of the following \(T\) lines contains a single integer \(n\) \( (1 \le n \le 10^9)\) denoting the total number of marbles for that test case.
outputFormat
For each test case, output one line containing a single integer indicating the maximum number of complete piles that can be formed.
## sample3
7
10
30
3
4
7
</p>