Coins And Triangle

All submissions for this problem are available.
Read problems statements in Mandarin Chinese , Russian and Vietnamese as well.
Chef belongs to a very rich family which owns many gold mines. Today, he brought N gold coins and decided to form a triangle using these coins. Isn't it strange?
Chef has a unusual way of forming a triangle using gold coins, which is described as follows:
 He puts 1 coin in the 1^{st} row.
 then puts 2 coins in the 2^{nd} row.
 then puts 3 coins in the 3^{rd} row.
 and so on as shown in the given figure.
Chef is interested in forming a triangle with maximum possible height using at most N coins. Can you tell him the maximum possible height of the triangle?
Input
The first line of input contains a single integer T denoting the number of test cases.
The first and the only line of each test case contains an integer N denoting the number of gold coins Chef has.
Output
For each test case, output a single line containing an integer corresponding to the maximum possible height of the triangle that Chef can get.
Constraints
 1 ≤ T ≤ 100
 1 ≤ N ≤ 10^{9}
Subtasks
 Subtask 1 (48 points) : 1 ≤ N ≤ 10^{5}
 Subtask 2 (52 points) : 1 ≤ N ≤ 10^{9}
Example
Input 3 3 5 7 Output 2 2 3
Explanation
 Test 1: Chef can't form a triangle with height > 2 as it requires atleast 6 gold coins.
 Test 2: Chef can't form a triangle with height > 2 as it requires atleast 6 gold coins.
 Test 3: Chef can't form a triangle with height > 3 as it requires atleast 10 gold coins.
Author:  ma5termind 
Tester:  xcwgf666 
Editorial  http://discuss.codechef.com/problems/TRICOIN 
Tags  binarysearch cakewalk implementation ltime35 ma5termind mathematics sqrt 
Date Added:  19042016 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.4, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions