Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- vector<int> countPoints(vector<vector<int>>& points, vector<vector<int>>& queries) {
- vector<int> ans;
- int x, y, r,xi, yi;
- for(int i=0; i<queries.size(); i++){
- int count = 0;
- x = queries[i][0];
- y = queries[i][1];
- r = queries[i][2];
- for(int j=0; j<points.size(); j++){
- xi = points[j][0];
- yi = points[j][1];
- int dist = (x-xi)*(x-xi)+(y-yi)*(y-yi);
- if(dist <= r*r) count++;
- }
- ans.push_back(count);
- }
- return ans;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement