Conveyor belts P70355


Statement
 

pdf   zip

html

[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 ℓ meters long, and it moves at a constant speed of c meters per second. Víctor, moving uniformly at v meters per second, spends a + b v2 energy units per second, where a and b are two positive constants. That is, he has a minimal cost a for breathing, plus an increase proportional to the square of his speed v w.r.t. to the ground he walks on. Moreover, we have the restriction v ≤ 10 (he is in top shape, but he cannot move faster than this).

Write a program such that, for each given combination of ℓ, c, a and b, 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 ℓ, c, a and b, all them strictly positive real numbers. Assume c < 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++