点击打开链接
//区间选点问题
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<string.h>
#include<math.h>
#include<algorithm>
#define inf 0x3f3f3f3f
#define LL long long
using namespace std;
struct node{
double left, right;
}Arr[2005];
int x[2005],y[2005];
bool cmp(node a, node b)
{
if(a.right== b.right) return a.left > b.left;
return a.right <b.right;
}
int main()
{
int i,j,n,d,num,flag,s=0;
double z,p;
while (scanf("%d %d",&n,&d)!=EOF) {
if(n==0&&d==0) break;
s++; flag=0;
for(i=0;i<n;i++){
scanf("%d %d",&x[i],&y[i]);
if(y[i]>d){
flag=1;
}
}
if(flag){
printf("Case %d: -1\n",s);
}
else{
for(i=0;i<n;i++){
z=sqrt(d*d*1.0-y[i]*y[i]*1.0);
Arr[i].left = (double)x[i]-z;
Arr[i].right = (double)x[i]+z;
}
sort(Arr, Arr+n, cmp);
num=0; p=-inf;
for(i=0; i<n; i++){
if(Arr[i].left>p){
num++;
p=Arr[i].right;
}
}
printf("Case %d: %d\n",s,num);
}
}
return 0;
}