贪心#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include <iostream>
#include<queue>
#include<stack>
#include<string>
typedef __int64 L;
using namespace std;
struct node
{
double x1;
double x2;
};
int cmp(node a,node b)
{
return a.x1<b.x1;
}
node qj[1010];
int main()
{
int n,range;
int mycase = 1;
while(cin>>n>>range,n||range)
{
int ok = 1;
for(int i=0;i<n;i++)
{
double x,y;
if(y<0) y=-y;
cin>>x>>y;
if(range<y) ok = 0;
else
{
qj[i].x1 = x-pow(range*range-y*y,0.5);
qj[i].x2 = x+pow(range*range-y*y,0.5);
}
}
sort(qj,qj+n,cmp);
int ans = 1;
double last = qj[0].x2;
for(int i=1;i<n;i++)
{
if(qj[i].x1>last)
{
ans++;
last = qj[i].x2;
}
else if(qj[i].x2<last)
{
last = qj[i].x2;
}
}
if(ok)
printf("Case %d: %d\n",mycase++,ans);
else
printf("Case %d: %d\n",mycase++,-1);
}
}
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include <iostream>
#include<queue>
#include<stack>
#include<string>
typedef __int64 L;
using namespace std;
struct node
{
double x1;
double x2;
};
int cmp(node a,node b)
{
return a.x1<b.x1;
}
node qj[1010];
int main()
{
int n,range;
int mycase = 1;
while(cin>>n>>range,n||range)
{
int ok = 1;
for(int i=0;i<n;i++)
{
double x,y;
if(y<0) y=-y;
cin>>x>>y;
if(range<y) ok = 0;
else
{
qj[i].x1 = x-pow(range*range-y*y,0.5);
qj[i].x2 = x+pow(range*range-y*y,0.5);
}
}
sort(qj,qj+n,cmp);
int ans = 1;
double last = qj[0].x2;
for(int i=1;i<n;i++)
{
if(qj[i].x1>last)
{
ans++;
last = qj[i].x2;
}
else if(qj[i].x2<last)
{
last = qj[i].x2;
}
}
if(ok)
printf("Case %d: %d\n",mycase++,ans);
else
printf("Case %d: %d\n",mycase++,-1);
}
}