#include<stdio.h>
#include<math.h>
float dis(float,float,float,float);
int main()
{
int t;
scanf("%d",&t);
if(t>=1&&t<=25)
{
int n,i,j;
float r,R,k,d,f,d1,d2,ff;
for(i=1;i<=t;i++)
{
scanf("%f",&r);
scanf("%f",&R);
if(r>=1&&R>=1&&R<=25000&&r<R)
{
scanf("%d",&n);
if(n>0&&n<=500)
{
int arr1[n],arr2[n];
float arr3[n];
for(j=1;j<=n;j++)
{
scanf("%d%d",&arr1[j],&arr2[j]);
if(arr1[j]!=arr2[j])
{
if(arr1[j]<0)
{
arr1[j]=arr1[j]*(-1);
}
if(arr2[j]<0)
{
arr2[j]=arr2[j]*(-1);
}
ff=sqrt(arr1[j]*arr1[j]+arr2[j]*arr2[j]);
if(ff>=r&&ff<=R)
{
f=dis(arr1[j],arr2[j],r,R);
arr3[j]=f;
}
else
{
printf("the distance is %f which is not in range\n",ff);
j--;
}
}
else
{
j--;
printf("coordinates are not alright\n");
}
}
for(j=2;j<=n;j++)
{
k=arr3[1];
if(arr3[j]<arr3[1])
{
arr3[1]=arr3[j];
arr3[j]=k;
}
}
printf("%0.3f\n",arr3[1]);
}
else if(n==0)
{
printf("%0.3f\n",R-r);
}
}
else printf(“the radius not in range\n”);
}
}
else
{
printf(“the number of cases should not exceed 25\n”);
main();
}
}
float dis(float x,float y,float r,float R)
{
float z,d1,d2;
z=sqrt(xx+yy);
printf(“the distance of the obstacle from the origin is%f\n”,z);
d1=z-r;
d2=R-z;
if(d1>=d2)
return d1;
else
return d2;
}