- 幾何
- 複素数ライブラリを使うと楽
- 角度でソートして尺取メソッド
int main() {
double r;
for (int X, Y; cin >> X >> Y >> r && r >= 0.0; ) {
int N;
cin >> N;
vector<double> angles;
for (int n = 0; n < N; ++n) {
int x, y;
cin >> x >> y;
x -= X;
y -= Y;
if (sqrt((double)x * x + y * y) < r + EPS) {
angles.push_back(atan2((double)y, (double)x));
}
}
const int M = angles.size();
const int M2 = M * 2;
sort(angles.begin(), angles.end());
for (int m = 0; m < M; ++m) {
angles.push_back(angles[m] + PI2);
}
int bestAnswer = 0;
int end = 0;
for (int m = 0; m < M; ++m) {
while (end < M2 && angles[end] < angles[m] + PI + EPS) {
++end;
}
bestAnswer = max(bestAnswer, end - m);
}
cout << bestAnswer << endl;
}
}