You will be running a race on a straight track, and you have devised the following trick to help you win. The weather forecast for the day of the race indicates that there will be a strong wind blowing directly from the finish line to the starting line. You ask the judges to allow you to run the race backward from the finish line to the starting line, and since they are unaware of your motives, they allow you to do so.
All participants, including you, will run at a constant speed for the duration of the race. Your competitors' speeds are given in the int[] speed, each element of which represents the speed of a competitor in meters per second. Your own speed in meters per second is given in the int yourSpeed.
The wind will blow at a constant speed of W meters per second. It will therefore increase your speed by W meters per second while decreasing the speed of each of your competitors by W meters per second. Return the minimum value of W that will allow you to win the race. Return 0.0 if you can win without the help of any wind. You will win the race even if you tie for first place. |