#include using namespace std; typedef long long int ll; typedef double ld; typedef pair ii; typedef vector vi; typedef vector vii; #define PB push_back #define ff first #define ss second #define DEB cerr<<"DEB: " #define FOR(prom,a,b) for(ll prom = (a); prom < (ll)(b); ++prom) #define ROF(prom,a,b) for(ll prom = (a); prom >= b; --prom) #define F(a) FOR(i,0,a) #define FF(a) FOR(j,0,a) #define EPS (1e-6) #define EQ(a,b) (fabs(a-b) <= fabs(b-a) * EPS) #define LINF (1LL<<62LL) ld Tf, Vf, Hf, Td, Vd, Hd; ld Gf = 1, Gd = 3; ld comp() { // Td ld vf = Gf*(Td-Tf); ld hf = Hf - 0.5*Gf*(Td-Tf)*(Td-Tf); ld a = 1; ld b = -(vf + sqrt(2.*Hd*Gd)); // ld c =-( Hf - 0.5*Gf*Tf*Tf + 0.5*Gd*Td*Td + Td*sqrt(2.*Hd*Gd)); ld c = hf; /* DEB << -b << endl; DEB << 2*a << endl; DEB<< "comp = " << b*b-4*a*c << endl; */ return (-b-sqrt(b*b-4.*a*c))/(2.*a); } int main() { scanf(" %lf %lf %lf %lf %lf %lf", &Tf, &Vf, &Hf, &Td, &Vd, &Hd); ld Tfa = sqrt(2*(Hf-Hd)/Gf) + Tf; ld Tfb = sqrt(2*Hf/Gf) + Tf; ld Tdc = sqrt(2*Hd/Gd) + Td; ld Tx = min((Vd*Td - Vf*Tf)/(Vd - Vf), (Tfb-Tf)*Vf/Vd + Td); ld Ty = comp()+Td; /* DEB << "Tfa = " << Tfa << endl; DEB << "Tfb = " << Tfb << endl; DEB << "Tdc = " << Tdc << endl; DEB << "Tx = " << Tx << endl; DEB << "Ty = " << Ty << endl; */ ld T; if (Tdc <= (Tfa + EPS) ) { // it is possible to catch it in Hd if ( Tx <= (Tfa + EPS) ) { T = Tfa + (Tfa-Tf)*Vf/Vd; } else { if( Tx >= (Tfb - EPS) ) { T = Tx + (Tfb-Tf)*Vf/Vd; } else { T = Tx + (Tx-Tf)*Vf/Vd; } } } else if (Tfb <= Tx + EPS) { // already on ground when started to jump ld S = (Tfb-Tf) * Vf; T = Tx + S/Vd; } else { // catch somewhere in between if ( Ty == (-5./0) ) throw("bug"); if ( Tx <= (Ty + EPS) ) { T = Ty + (Ty-Tf)*Vf/Vd; } else { if( Tx >= (Tfb - EPS) ) { T = Tx + (Tfb-Tf)*Vf/Vd; } else { T = Tx + (Tx-Tf)*Vf/Vd; } } } printf("%.8lf\n", T); return 0; } /* 1 2 160 12 10 100 DEB: Tfa = 11.9545 DEB: Tfb = 18.8885 DEB: Tdc = 20.165 DEB: Tx = 14.75 DEB: Ty = 15.0685 17.88218363*/