Problem A
Driver's Dilemma

A car driver visiting Canada from the US travels on a road through isolated New Brunswick territory (no gas stations, houses, or cell phone coverage). Ominous road signs warn about collision risks from deer and moose after dark. Suddenly the driver glances at his fuel gauge with shock: there is exactly half a tank left. He stops and sees that his fuel tank is leaking, which accounts for some of the fuel gauge drop since the last fill up.
The driver cannot repair the leak. Using a container of
known volume and his wristwatch, he measures the rate of fuel
loss at
The driver checks the owner’s manual for his rented compact
car and finds that the fuel tank capacity is
Since the driver assumes that people who write manuals must
be experts, and since he has an aversion to interpolation (and
also to extrapolation), he decides that he will drive at
exactly one of the
Can the driver reach the gas station before running out of fuel? If so, at what maximum speed can he drive?
Speed (MPH) |
Fuel Efficiency (MPG) |
|
|
|
|
|
|
|
|
|
|
|
|
Input
Input consists of a single test case occupying
Output
If it is possible for the driver to reach the nearest gas
station without running out of gas, output “YES” followed by the highest speed at which the
driver can drive (separated by a space). This highest speed
must be one of the integers
Sample Input 1 | Sample Output 1 |
---|---|
18 0.5 160 55 22.0 60 21.3 65 20.2 70 18.3 75 16.9 80 15.8 |
YES 60 |
Sample Input 2 | Sample Output 2 |
---|---|
16 0.07 160 55 20.49 60 18.40 65 17.78 70 17.10 75 16.38 80 15.60 |
NO |