#include<IOSTREAM>
#include <MATH.H>
#include <algorithm>
using namespace std;
struct point{
double left,right;
}p[2010],temp;
bool operator >(point a,point b){
return a.left>b.left;
}
int main(){
int r,n;
int ca;
while (cin>>n>>r&&(n||r))
{
double ix,iy;
ca=0;
bool flag;
for(int i=0;i<n;i++)
{
flag=false;
cin>>ix>>iy;
if(fabs(iy)>r)
flag=true;
else
{
p[i].left=ix-sqrt(r*r-iy*iy);
p[i].right=ix+sqrt(r*r-iy*iy);
}
}
cout<<"Case "<<ca+1<<": ";
if(flag)
cout<<-1<<endl;
else
{
int count=1;
sort(p,p+n);
temp=p[0];
for(int j=1;j<n;j++)
{
if(p[i].left>temp.right)
{
count++;
temp=p[i];
}
else if(p[i].right<temp.right)
temp.right=p[i].right;
}
cout<<count<<endl;
}
}
return 0;
}
poj1328
最新推荐文章于 2020-06-01 18:18:21 发布