#include<iostream> #include<algorithm> #include<cmath> usingnamespace std; constint MAXN = 1e5; int L, D; structpoint { int x; int y; point(int a = 0, int b = 0) { x = a; y = b; } }; point points[MAXN];
doublegetp(int a, int b)//在x轴上向右找到距离(a,b)小于等于L的最远的点 { double x = sqrt(pow(D, 2) - pow(b, 2)) + a;//距离等于L的点 if (x >L) return L; return x; } booljudge(point p, int x)//判断p点距离(x,0)是否小于D { int a = p.x; int b = p.y; double dis =pow(x - a, 2) + pow(b, 2); if (dis <= pow(D, 2)) returntrue; returnfalse; } boolcmp(point a, point b) { if (a.x == b.x) return a.y > b.y; return a.x < b.x; } intmain() { while (cin >> L) { cin >> D; int N; cin >> N; int cnt = 0; double x; for (int i = 0; i < N; i++) { cin >> points[i].x >> points[i].y; } sort(points, points + N, cmp); cnt++; x = getp(points[0].x, points[0].y); for (int i = 0; i < N; i++) { if (judge(points[i], x)) continue; else { x = getp(points[i].x, points[i].y); cnt++; } } cout << cnt << endl; } return0; }