NYOJ287

//#define LOCAL
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
int const MAX_N=1001;
typedef struct Point{
    double x,y;
    bool operator<(const Point &other) const
    {
        return x<other.x;
    };
}Point;
Point Vec[MAX_N];
int N,R,K,x,y,conn=1;
void solve()
{
    int coun=0,i;
    double sum;    
    for(i=0;i<N;i++)
    {
        scanf("%d%d",&x,&y);
        double temp=sqrt(R*R-y*y);
        Vec[i].x=x-temp;
        Vec[i].y=x+temp;
    }
       std::sort(Vec,Vec+N);
       sum=Vec[0].y;
       coun=1;
       for(i=1;i<N;i++)
    {
        if(sum<Vec[i].x)
        {
                coun++;
                sum=Vec[i].y;
        }
        else
        {
            if(sum>Vec[i].y)
            {
                //
                sum=Vec[i].y;
            }
        }
    }
    printf("Case %d: %d\n",conn++,coun);
}
int main()
{
#ifdef LOCAL
    freopen("287.in","r",stdin);
    freopen("287.out","w",stdout);
#endif
    while(~scanf("%d%d",&N,&R)&&N&&R)
    {
        solve();
    }
    return 0;
}

 

 

posted @ 2014-05-15 09:40  剑风云  阅读(271)  评论(0编辑  收藏  举报