极角排序扫一圈。

今天没什么状态写个水题减轻负罪感(大雾)

 #include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
typedef double db;
const db eps = 1e-;
const db pi = acos(-);
int sign(db k){
if (k>eps) return ; else if (k<-eps) return -; return ;
}
int cmp(db k1,db k2){return sign(k1-k2);}
struct point{
db x,y,ang;
point operator + (const point &k1) const{return (point){k1.x+x,k1.y+y};}
point operator - (const point &k1) const{return (point){x-k1.x,y-k1.y};}
point operator * (db k1) const{return (point){x*k1,y*k1};}
point operator / (db k1) const{return (point){x/k1,y/k1};}
int operator == (const point &k1) const{return cmp(x,k1.x)==&&cmp(y,k1.y)==;}
db abs(){ return sqrt(x*x+y*y);}
db dis(point k1){return ((*this)-k1).abs();}
db getw(){return atan2(y,x);}
};
struct circle{
point o;db r;
int inside(point k){return cmp(r,o.dis(k))>=;}
}c;
vector<point> v;
bool cmp2(point a,point b){
return a.ang<b.ang;
}
int n;point t;
int main(){
while (scanf("%lf%lf%lf",&c.o.x,&c.o.y,&c.r)&&c.r>){
//scanf("%lf%lf%lf",&c.o.x,&c.o.y,&c.r);
scanf("%d",&n);
while (n--){
scanf("%lf%lf",&t.x,&t.y);
if(c.inside(t)){
t.ang = (c.o-t).getw();
v.push_back(t);
v.push_back({t.x,t.y,t.ang+*pi});
}
}
sort(v.begin(),v.end(),cmp2);
int m = v.size()/;
int ans = ;
for(int l=,r=;l<m;l++){
while (r<*m&&v[r].ang-v[l].ang<=pi)
r++;
ans=max(ans,r-l);
}
printf("%d\n",ans);
v.clear();
}
}
05-03 20:46