This page is still under construction.

Parts of this page are still being built. What you see may change.

Sangkeun's Girlfriend

Time limit1sMemory limit128 MB

Summary
Choose a constant driving speed that minimizes travel time given a fuel budget over a fixed distance, output truncated to two decimals.
Level

Medium7 of 10

Topics
Math, Binary search, Greedy
Solved
No attempts yet

Problem

Sangkeun has to go pick up his girlfriend. His car has tt units of fuel, and his girlfriend is mm kilometers away from his current location.

He needs to arrive as fast as possible, so there is no time to stop at a gas station along the way. When the car travels at a speed of vv kilometers per hour, the amount of fuel consumed in one hour is:

av4+bv3+cv2+dva v^4 + b v^3 + c v^2 + d v

Sangkeun drives at a constant speed the whole way, from departure to arrival. Find the speed, in kilometers per hour, at which he should drive so that he reaches his girlfriend as fast as possible without running out of fuel.

Input

The input consists of several test cases. Each test case contains six non-negative real numbers aa, bb, cc, dd, mm, tt, in that order. Every value is at most 10001000, and cc, dd, mm, and tt are positive. The input is guaranteed to contain only cases for which an answer exists. The input continues until the end of the file.

Output

For each test case, print the speed in kilometers per hour that lets Sangkeun arrive as fast as possible without running out of fuel, to two decimal places. Any digits beyond the second decimal place are truncated (rounded down).

Examples1

  1. Example 1

    Input
    0.000001 0.0001 0.029 0.2 12 100
    2.8e-8 7.6e-6 0.0013 0.47 11.65 20.81
    1.559e-7 1.8195e-5 0.0022233 0.31292 58.902 85.585
    
    Expected output
    134.41
    257.45
    142.65