//POJ1328
//Radar
//http://poj.org/problem?id=1328
#include
#include
#define SIZE 100
double arr[SIZE][2];
typedef struct intersection{
double LP;
double RP;
}Inter;
Inter data[SIZE];
//将岛屿按照坐标X排序(升序
void Change(int num){
int r1,r2;
double tempx,tempy;
for(r1=0;r1){
for(r2=r1+1;r2){
if(arr[r1][0]>arr[r2][0]){
tempx=arr[r1][0];
arr[r1][0]=arr[r2][0];
arr[r2][0]=tempx;
tempy=arr[r1][1];
arr[r1][1]=arr[r2][1];
arr[r2][1]=tempy;
}
}
}
}
//计算以(x,y)为圆心,雷达距离为半径所画的圆,与X轴的交点
void Cal(double x, double y, int radar, int p){
double temp=sqrt(pow(radar*1.0,2.0)-pow(y,2.0));
data[p].LP=x-temp;
data[p].RP=x+temp;
}
//num是岛屿数,radar是雷达的覆盖范围
int Check(int num, int radar){
int RadarCount=0,
r1=0;
for(r1=0;r1){
Cal(arr[r1][0],arr[r1][1],radar,r1);
}
int r2;
for(r1=0;r1<num;){
RadarCount++;
//printf("%d\n",temp);
for(r2=r1+1;r2){
//printf("r1:%d,r2:%d\n",r1,r2);
if(data[r1].RP>data[r2].LP);
else break;
}
r1=r2;
}
/*
检查计算岛屿与X轴交点的坐标是否正确
for(r1=0;r1*/
return RadarCount;
}
int main(void){
//n是岛屿数,d是雷达的覆盖距离
int n,d,r1,r2;
int result[SIZE],resultcount=0,nothing=0;
while(scanf("%d%d",&n,&d)==2 && n!=0 && d!=0){
nothing=0;
for(r1=0;r1){
scanf("%lf%lf", &arr[r1][0], &arr[r1][1]);
if(arr[r1][1]>d){
result[resultcount]=-1;
nothing=-1;
}
}
//puts("Get!");
if(nothing!=0) continue;
//for(r1=0;r1//将岛屿按找X坐标排序
Change(n);
//for(r1=0;r1
result[resultcount]=Check(n,d);
resultcount++;
}
for(r1=0;r1"case%d:%d\n",r1+1,result[r1]);
return 0;
}