#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
#include <iostream>
const double PI=acos(-1.0);
using namespace std;
typedef long long ll;
struct node
{
int x,y;
double l,r;
}isl[1005];
double radar[1005];
bool cmp(node a,node b)
{
return a.x<b.x;
}
int main()
{
int n,d,cas=1;
while(~scanf("%d%d",&n,&d)&&n&&d) {
int fflag=0;
for(int i=0;i<n;i++) {
scanf("%d%d",&isl[i].x,&isl[i].y);
if(isl[i].y>d||-1*isl[i].y<-d) {
fflag=1;
}
double ll=sqrt(d*d*1.0-isl[i].y*isl[i].y);
isl[i].l=isl[i].x-ll;
isl[i].r=isl[i].x+ll;
}
if(fflag==1) {
printf("Case %d: -1\n",cas++);
continue;
}
sort(isl,isl+n,cmp);
double place;
int ans=1;
place=isl[0].r;
for(int i=1;i<n;i++) {
if(isl[i].l>place) {
ans++;
place=isl[i].r;
}
else if(isl[i].r<place) {
place=isl[i].r;
}
}
printf("Case %d: %d\n",cas++,ans);
}
return 0;
}
POJ1328
最新推荐文章于 2024-04-13 15:50:48 发布