# UVA 1615（贪心+维护区间）（简单题）

#include <bits/stdc++.h>
#define FOPI freopen("INPUT.TXT", "r", stdin)
#define DOPI freopen("OUTPUT.TXT", "w", stdout)
#define FOR(i, x, y) for(int i = x; i <= y; i ++)
#define ROF(i, x, y) for(int i = x; i >= y; i --)
using namespace std;
typedef long long int ll;
const int ind=0x3f3f3f3f,N=1e6+10;
const ll inlld=0x3f3f3f3f3f3f3f3f,mod=998244353;
struct node
{
int x,y;
}s[N];
bool cmp(node a,node b)
{
if(a.x==b.x)return a.y>b.y;
return a.x<b.x;
}
double getans(int x,int y,int d)
{
return sqrt((double)d*d-(double)y*y)+(double)x;
}
int judgeans(int x,int y,double cnt,int d)
{
if(((double)x-cnt)*((double)x-cnt)+(double)y*(double)y<=(double)d*d)return 1;
return 0;
}
int main()
{
//    DOPI;
ios::sync_with_stdio(false);
int l,d,n;
while(cin>>l){
cin>>d>>n;
for(int i=1;i<=n;i++)cin>>s[i].x>>s[i].y;
sort(s+1,s+1+n,cmp);
int ans=1;
double cnt=getans(s[1].x,s[1].y,d);
for(int i=1;i<=n;i++){
if(judgeans(s[i].x,s[i].y,cnt,d))continue;
cnt=min(getans(s[i].x,s[i].y,d),(double)l);ans++;
//            cout << cnt<< ' ' << ans << endl;
}
cout<<ans<<endl;
}
return 0;
}
/*
100
50
3
2 4
50 10
70 30
*/



©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客