import java.util.Scanner;
/*序号乘方
Description
There are Infinite People Standing in a row,
indexed from 1.A person having index 'i' has strength of (i*i).
You have Strength 'P'.
You need to tell what is the maximum number of People You can Kill With your Strength P.
You can only Kill a person with strength 'X' if P >= 'X' and after killing him,
Your Strength decreases by 'X'.
无数人站成一排,
索引自1。索引为“i”的人的强度为(i*i)。
你有力量“P”。
你需要知道你能用你的力量杀死的最大人数是多少。
你只能用力量“X”杀死一个人,如果P>=“X”,在杀死他之后,
你的力量减少X。
Input
First line contains an integer 'T' - the number of testcases,Each of the next 'T' lines contains an integer 'P'- Your Power.Constraints:1<=T<=100001<=P<=1000000000000000
第一行包含一个整数'T'-测试用例的数量,接下来的每一行都包含一个整数'P'-您的权力约束:1<=T<=100001<=P<=10000000000000
Output
For each testcase Output The maximum Number of People You can kill.
Sample Input 1
1
14
Sample Output 1
3
1 4 9*/
public class Main {
static Scanner scanner=new Scanner(System.in);
public static void main(String args[]){
int T=scanner.nextInt();
for (int t=0;t<T;t++){
int p=scanner.nextInt();
System.out.println(killPeople(p));
}
}
/**
* @param p
* @return
*/
private static int killPeople(int p) {
int count=0;
int index=1;
while(p>0){
p=p-index*index;
index++;
if(p>=0){
count++;
}
}
return count;
}
}
03-03