#include using namespace std; #define double long double #define int long long const double kEps = 1e-9; const double kPi = 2 * acos(0); double Sq(double x) {return x * x;} struct Point { double x, y; Point() {} Point(double a, double b) : x(a), y(b) {} Point(const Point &a) : x(a.x), y(a.y) {} double DotProd(const Point &a) const {return x * a.x + y * a.y;} void operator=(const Point &a) {x = a.x; y = a.y; } Point operator-(Point &a) const { Point p(x - a.x, y - a.y); return p; } Point operator+(Point &a) const { Point p(x + a.x, y + a.y); return p; } Point operator*(double a) const { Point p(x * a, y * a); return p; } Point operator/(double a) const { assert(abs(a) > kEps); Point p(x / a, y / a); return p; } double Norm() const {return sqrt(Sq(x) + Sq(y)); } double Dist(Point &a) const { return (*this - a).Norm(); } }; struct Circle { Point center; double r; Circle (Point c, double rr) : center(c), r(rr) {} }; struct Line { Point p[2]; bool is_seg; Line(Point a, Point b, bool is_seg_ = false) { p[0] = a; p[1] = b; is_seg = is_seg_; } Point &operator[](int a) { return p[a]; } }; Point ProjPointToLine(Point p, Line l) { Point diff = l[1] - l[0]; Point x = diff * (diff.DotProd(p - l[0]) / diff.DotProd(diff)); return l[0] + x; } vector InterCircleLine(Circle c, Line l) { Point proj = ProjPointToLine(c.center, l); double dis_proj = c.center.Dist(proj); if (dis_proj > c.r + kEps) return {}; if (dis_proj > c.r - kEps) return {proj}; double a = sqrt(Sq(c.r) - Sq(dis_proj)); Point dir = l[1] - l[0]; double dir_norm = dir.Norm(); Point aaa = dir * (a / dir_norm); Point bbb = dir * (a / dir_norm); vector cands{proj + aaa, proj - bbb}; if (cands[0].Dist(cands[1]) < kEps) return {proj}; return cands; } struct moj { double kiedy; int ile; bool operator<(const moj &other) const { return kiedy < other.kiedy; } }; vector tab; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, r, a, b; cin >> n >> r >> a >> b; Line l(Point(0, 0), Point(a, b)); for (int x, y, i = 1; i <= n; i++) { cin >> x >> y; Circle c(Point(x, y), r); vector v = InterCircleLine(c, l); if (v.empty()) continue; if (v.size() < 2) v.push_back(v[0]); if (a == 0) { v[0].x = v[0].y; v[1].x = v[1].y; } if (v[0].x > v[1].x) { swap(v[0], v[1]); } tab.push_back({v[0].x - kEps, 1}); tab.push_back({v[1].x + kEps, -1}); } sort(tab.begin(), tab.end()); int res = 0; int suma = 0; for (moj &i : tab) { suma += i.ile; res = max(res, suma); } cout << res; return 0; }/* 8 2 5 0 0 1 1 1 2 1 3 1 0 2 1 2 2 2 3 2 6 1 1 0 0 0 1 1 1 -1 2 0 -100 -100 100 100 */