#include #include #include using namespace std; int xx1, yy1, xx2, yy2; double f(double y) { return hypot(xx1, yy1-y)+hypot(xx2, yy2-y); } int main(void) { scanf("%d%d%d%d", &xx1, &yy1, &xx2, &yy2); double left = min(yy1, yy2); double right = max(yy1, yy2); for (int loop = 0; loop < 1000; ++loop){ if (f((left * 2 + right) / 3) < f((left + right * 2) / 3)){ right = (left + right * 2) / 3; } else { left = (left * 2 + right) / 3; } } printf("%.10f\n", (left+right)/2.0); return 0; }