#include #define double long double #define ll long long using namespace std; const int MAXN=2000+5; const int MOD=(1<<10)-1; int T,a,b,X; void solve() { scanf("%d%d%d",&a,&b,&X); assert(a>=1&&a<=1000000); assert(b>=1&&b<=1000000); assert(X>=1&&X<=1000000); double st1=0,st2=0,d1=X,d2=X; if(X>=b) { st2=sqrt((double)X*X-(double)b*b); double st3=st2+st2; d1=max((double)X,st3); d2=max(d1+st2,st2+X);d2-=st2; } int L=floor((a-st1)/d1)+1; double posl=st1+d1*(L-1); int R=0; if(a>=st2) R=floor((a-st2)/d2)+1; double posr=0; if(R) posr=st2+d2*(R-1); assert(posl<=a&&posr<=a); double Minl=0; double Maxr=b; double Eps=1e-14; int ans=L+R; if(a-posl<=X) { Minl=sqrt((double)X*X-(double)(a-posl)*(a-posl)+Eps); } if(a-posr<=X) { Maxr=b-sqrt((double)X*X-(double)(a-posr)*(a-posr)+Eps); } // printf("%d %lf %lf\n",ans,Minl,Maxr); if(Minl-Eps<=Maxr) { ans++; ans+=floor((Maxr-Minl+0.0000001)/X); } printf("%d\n",ans); } int main() { scanf("%d",&T); while(T--) solve(); return 0; }