Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <cmath>
  4. using namespace std;
  5. struct point {double x,y;};
  6. int n;
  7. double maxp=0.0,per=0.0;
  8. double rast (double x1, double x2, double y1, double y2)
  9. {
  10. double d;
  11. d=sqrt(pow(x1-x2,2)+pow(y1-y2,2));
  12. return d;
  13. }
  14. int main ()
  15. {
  16. cin >> n;
  17. point p[n];
  18. for (int i=0; i<n; i++)
  19. cin >> p[i].x >> p[i].y;
  20. for (int i=0; i<n; i++)
  21. for (int j=0; j<n; j++)
  22. for (int k=0; k<n; k++)
  23. {
  24. per=0.0;
  25. per=per+rast(p[i].x,p[j].x,p[i].y,p[j].y);
  26. per=per+rast(p[j].x,p[k].x,p[j].y,p[k].y);
  27. per=per+rast(p[k].x,p[i].x,p[k].y,p[i].y);
  28. if (per>maxp) maxp=per;
  29. }
  30. cout << maxp;
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement