fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test \
  4.   int t; \
  5.   cin >> t; \
  6.   while (t--)
  7. #define ll long long
  8. #define endl '\n'
  9. #define cendl cout << endl
  10. #define cyes cout << "YES" << endl
  11. #define cno cout << "NO" << endl
  12. #define InTheNameOfAllah \
  13.   ios_base::sync_with_stdio(0); \
  14.   cin.tie(0);
  15.  
  16. struct point {
  17. double x, y;
  18. };
  19. bool cmp(point p1, point p2) {
  20. return p1.x == p2.x && p1.y == p2.y;
  21. }
  22. int main() {
  23. InTheNameOfAllah
  24. point p1,
  25. p2, p3, p4;
  26. while (cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y) {
  27. if (p1.y > p2.y)
  28. swap(p1, p2);
  29.  
  30. double dx = p2.x - p1.x, dy = p2.y - p1.y;
  31. cout << fixed << setprecision(3);
  32. if (cmp(p3, p1)) {
  33. p4.x += dx;
  34. p4.y += dy;
  35. cout << p4.x << ' ' << p4.y << endl;
  36. } else if (cmp(p3, p2)) {
  37. p4.x -= dx;
  38. p4.y -= dy;
  39. cout << p4.x << ' ' << p4.y << endl;
  40. } else {
  41. swap(p3,p4);
  42. if (cmp(p3, p1)) {
  43. p4.x += dx;
  44. p4.y += dy;
  45. cout << p4.x << ' ' << p4.y << endl;
  46. } else if (cmp(p3, p2)) {
  47. p4.x -= dx;
  48. p4.y -= dy;
  49. cout << p4.x << ' ' << p4.y << endl;
  50. }
  51. }
  52.  
  53. }
  54. return 0;
  55. }
Success #stdin #stdout 0.01s 5304KB
stdin
Standard input is empty
stdout
Standard output is empty