//寻找公式,思路是先列举每一跳所能跳的最远距离,然后发现规律,再注意下y-x=0时候的判断即可 //结果得出数列 //0,1,2,4,6,9,12,16,20,25,30....... //0,0+1,1+1,2+2,4+2,6+3,9+3,12+4,16+4..... #include<iostream> using namespace std; int main() { int t,x,y,temp,cnt,ans; scanf("%d",&t); while(t--) { scanf("%d%d",&x,&y); temp = y - x; cnt = ans = 0;; if(temp > 0) { while(temp > 0) { temp -= ++cnt; ++ans; if(temp > 0) { temp -= cnt; ++ans; } } printf("%d/n",ans); } else printf("0/n"); } return 0; }