在纸上画了下,用全等三角形定则,找了下规律。
#include <stdio.h> #include <math.h> double compute(double x1, double y1, double x2, double y2) { return (x1+x2+y1-y2)/2; } int main() { double x[4], y[4]; while (scanf("%lf%lf%lf%lf", &x[0], &y[0], &x[1], &y[1]) != EOF) { if (fabs(x[0]-x[1])<1e-9 && fabs(y[0]-y[1])<1e-9) { printf("Impossible.\n"); continue; } x[2] = compute(x[0], y[0], x[1], y[1]); x[3] = compute(x[1], y[1], x[0], y[0]); y[3] = compute(y[0], x[0], y[1], x[1]); y[2] = compute(y[1], x[1], y[0], x[0]); printf("%.10lf %.10lf %.10lf %.10lf\n", x[2], y[2], x[3], y[3]); } return 0; }