N : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16...
G : 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6....
The portal:http://acm.tju.edu.cn/toj/showp4101.html
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
void Deal_with(){
int T;
scanf("%d",&T);
while(T--){
long long n;
scanf("%lld",&n);
long long Left = 0,Right = 100000,Mid,ans;
while(Left < Right){
Mid = (Left + Right) / 2;
if(Mid*(Mid+1)/2 < n){
Left = Mid + 1;
}
else {
Right = Mid;
}
}
printf("%d\n",Right);
}
}
int main(void){
//freopen("a.in","r",stdin);
Deal_with();
return 0;
}