staircase-problem-2

Joy is a short and lazy guy, he uses elevator to reach his flat. But unfortunately elevator is not working today and he became sad. Suddenly God came and made the stairs magical, such that he can jump on it in a magical way. Initially he can take 1 or 2  steps. If he jumps x steps at a time then in the next step he can climb either x or x+1 steps depending on his choice and he must reach exactly on n'th step. Help him find the minimum number of jumps to be made.

INPUT

First line will contain t, total number of test case
Next t lines contains n (total number of steps).

0<t ≤ 100

0<n ≤ 10^5

OUTPUT

Minimum steps to reach the stairs.
Register for IndiaHacksSAMPLE INPUT
2
2
3

SAMPLE OUTPUT
1
2

Register for IndiaHacks

Source: hackerearth | Difficulty: EASY


Solutions:
import math
cases = int(input())

for case in range(cases):
	t = int(input())
	
	ans = (-1 + pow(1+8*t, 0.5))/2
	print(int(math.floor(ans)))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
t=eval(input())
while t>0:
	t-=1
	n=eval(input())
	c=1
	l=1
	while n>l+1:
		n=n-l-1
		c+=1
		l=l+1
	print(c)


for _ in range(int(input())):
	n=eval(input())
	c,m=0,2
	while(n>0):
		n-=m
		c+=1
		m+=1
	print(c)


for _ in range(int(input())):
	n=eval(input())
	c,m=0,2
	while(n>0):
		n-=m
		c+=1
		m+=1
	print(c)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
t=eval(input())
while t>0:
	t-=1
	n=eval(input())
	c=1
	l=1
	while n>l+1:
		n=n-l-1
		c+=1
		l=l+1
	print(c)