Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <vector>
- #include <cmath>
- using namespace std;
- struct Point {
- int x, y;
- Point(): x(0),y(0) {};
- Point(int a, int b): x(a), y(b) {};
- Point operator -(const Point& p) {
- return Point(x - p.x, y - p.y);
- }
- float distance() {
- return sqrt(x * x + y * y);
- }
- };
- int main()
- {
- int n, a, b;
- cin >> n;
- double maxim = 0;
- vector <Point> pnt (n);
- for (int i = 0; i < n; ++i)
- {
- cin >> a >> b;
- pnt[i] = Point(a, b);
- }
- for (int i = 0; i < n; ++i)
- {
- for (int j = i + 1; j < n; ++j)
- {
- float d = (pnt[i] - pnt[j]).distance();
- if (d > maxim)
- maxim = d;
- }
- }
- cout << setprecision(15) << maxim;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement