Conveyor belts P70355


Statement
 

pdf   zip

ifnextchar ( ifnextchar (offsettrue(0pt,0pt) offsetfalse ifnextchar [(0pt,0pt)(0pt,0pt) ifnextchar [(0pt,0pt)(0pt,0pt)[l](0pt,0pt)(0pt,0pt)[l][] [r]

Víctor González likes walking on the conveyor belts of the airports in the opposite direction. Help him to spend the minimum possible energy to traverse them completely, using the following model:

Each conveyor belt is \ell meters long, and it moves at a constant speed of cc meters per second. Víctor, moving uniformly at vv meters per second, spends a+bv2a + b v^2 energy units per second, where aa and bb are two positive constants. That is, he has a minimal cost aa for breathing, plus an increase proportional to the square of his speed vv w.r.t. to the ground he walks on. Moreover, we have the restriction v10v \le 10 (he is in top shape, but he cannot move faster than this).

Write a program such that, for each given combination of \ell, cc, aa and bb, prints the speed with which Victor will spend the minimum amount of energy while traversing the conveyor belt in opposite direction.

Input

Input consists of several cases, each with \ell, cc, aa and bb, all them strictly positive real numbers. Assume c<10c < 10.

Output

For every case, print in a line the optimal speed with 4 digits after the decimal point. Input cases do not have precision issues.

Public test cases
  • Input

    100 2 5 1
    100 1 1.5 1.5
    200 1 7 7
    100 5 4 4
    

    Output

    5.0000
    2.4142
    2.4142
    10.0000
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++