#include #include #include using namespace std; int Tf, Vf, Hf, Td, Vd, Hd; double yDog(double t) { if (tTd + sqrt(6*Hd)/3) return Hd; return sqrt(6*Hd)*(t-Td)-3*(t-Td)*(t-Td)/2; } double xDog(double t){ if (tTf+sqrt(2*Hf)) return 0; return Hf-(t-Tf)*(t-Tf)/2; } double xFrisbee(double t){ if (tTf+sqrt(2*Hf)) return Vf*(sqrt(2*Hf)); return Vf*(t-Tf); } bool is_ok(double t, double& xM) { double yd = yDog(t); double yf = yFrisbee(t); double xd = xDog(t); double xf = xFrisbee(t); //printf("%lf %lf %lf %lf %lf\n", yd, yf, xd, xf, t); if (yDog(t) > yFrisbee(t) && xDog(t) > xFrisbee(t)) { xM = min(xDog(t), xFrisbee(t)); return true; } return false; } int main() { scanf("%d %d %d %d %d %d", &Tf, &Vf, &Hf, &Td, &Vd, &Hd); double left = 0; double right = 1e18; double xM = -1; for (int i=0; i<1000; i++) { double mid = (right+left)/2; if (is_ok(mid, xM)) { right = mid; } else { left = mid; } } printf("%.10lf\n", left + xM/Vd); }