The triple jump works as follows. The athlete runs down a runway until he reaches a designated mark. He then makes three consecutive jumps and lands in a sand-filled box. The length of the triple jump is the sum of the lengths of the three consecutive jumps. The winner of the competition is the athlete with the longest triple jump.
You are taking part in the competition and jumping after all your opponents. Since you are the last to jump, you already know all your opponents' results. They are given in the int[] **opponents**, where **opponents**[i] is the length of the i-th opponent's triple jump in centimeters.
You have already made the first of your three jumps, and it was **first** centimeters long. You ask yourself a question: "What is the probability that I will take first place? Second place? And all the other places?". You know that each of your two remaining jumps will be between **lower** and **upper** centimeters, inclusive, in length. The lengths will not necessarily be integers, and all possible lengths between **lower** and **upper** will be equally likely. Return a double[] containing exactly N + 1 elements (N is the number of opponents you have) such that the i-th element (0-indexed) is the probability of you taking (i+1)-th place. Note that your place number is equal to one plus the number of opponents who had longer triple jumps than you. |