CodeForces - 842B
1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main() { 5 int r,d,t; 6 double temp,x,y,z; 7 while(~scanf("%d %d",&r,&d)) { 8 scanf("%d",&t); 9 int ans = 0; 10 for(int i = 0; i < t; i++) { 11 scanf("%lf %lf %lf",&x,&y,&z); 12 temp = sqrt(x*x + y*y) - z ; 13 if (temp >= (r-d) && temp + z + z <= r ) ans++; 14 } 15 cout<<ans<<endl; 16 } 17 return 0; 18 }