rt。
题面
代码:
#include <bits/stdc++.h>
using namespace std;
struct app
{
int s,e,r;
}a[15001];
int cmp(app x,app y)
{
return x.s<y.s;
}
int main()
{
int t,n,l,w,p,r,now,ans,flag,rp,use,maxx,cnt;
cin>>t;
while(t--)
{
cnt=0;
use=0;
flag=0;
ans=0;
rp=0;
cin>>n>>l>>w;
for(int i=1;i<=n;i++)
{
cin>>p>>r;
if(r*2<w) continue;
a[++cnt].s=p-sqrt((r*r)-(w*w/4.0));
a[cnt].e=p+sqrt((r*r)-(w*w/4.0));
a[cnt].r=r;
}
sort(a+1,a+cnt+1,cmp);
for(int i=1;i<=cnt;i++)
{
if(a[i].s>rp)
{
ans=-1;
break;
}
maxx=-1;
for(int j=1;j<=cnt;j++)
{
if(a[j].s>rp) break;
if(a[j].e>=maxx)
{
now=j;
maxx=a[j].e;
}
}
ans++;
rp=a[now].e;
if(rp>=l) break;
}
cout<<ans<<endl;
}
return 0;
}