7月4日 Fourth Point !!

发布时间 2023-08-23 21:17:33作者: tlocd

Fourth Point !!

#include <iostream>

using namespace std;
class point {
public:
  double x;
  double y;

  bool equals(const point &p) {
    if (p.x == x && p.y == y)
      return true;
    return false;
  }
};

int main() {
  point a, b, c, d;
  while (cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y) {
    point e;
    if (a.equals(c)) {
      swap(a, b);
    } else if (a.equals(d)) {
      swap(a, b);
      swap(c, d);
    } else if (b.equals(d)) {
      swap(c, d);
    }
    e.x = d.x + a.x - b.x;
    e.y = a.y + d.y - b.y;
    printf("%.3f %.3f\n", e.x, e.y);
  }

  return 0;
}