1828.cpp (547B)
1 class Solution { 2 public: 3 vector<int> countPoints(const vector<vector<int>> &points, const vector<vector<int>> &queries) { 4 vector<int> res(queries.size(), 0); 5 for (int i = 0; i < queries.size(); i++) { 6 int r2 = queries[i][2] * queries[i][2]; 7 for (int j = 0; j < points.size(); j++) { 8 int dx = points[j][0] - queries[i][0]; 9 int dy = points[j][1] - queries[i][1]; 10 if (dx * dx + dy * dy <= r2) res[i]++; 11 } 12 } 13 return res; 14 } 15 };