标签:style blog class code java c
//#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; }
标签:style blog class code java c
原文地址:http://www.cnblogs.com/jianfengyun/p/3729272.html