Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <cmath>
- using namespace std;
- ifstream in("input.txt");
- ofstream out("output.txt");
- struct point {
- int x, y;
- void print();
- };
- void point::print() {
- out << x << " " << y << " " << endl;
- }
- double len(point a, point b) {
- return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
- }
- int main() {
- point circle, a[100];
- double r;
- cin >> r;
- int n = 0;
- while (in.peek() != EOF) {
- int x,y;
- in >> x >> y;
- a[n].x = x;
- a[n].y = y;
- n++;
- }
- n--;
- point ans;
- int k = INT_MIN;
- for (int i = 0; i < n; i++) {
- circle.x = a[i].x;
- circle.y = a[i].y;
- int cnt = 0;
- for (int j = 0; j < n; j++) {
- if (len(circle,a[j]) <= r) {
- cnt++;
- }
- }
- if (cnt > k) {
- ans.x = circle.x;
- ans.y = circle.y;
- k = cnt;
- }
- }
- ans.print();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement