eolymp
bolt
Try our new interface for solving problems
Problems

Triple Jump

Triple Jump

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. You have already made the first of your three jumps, and it was \textbf{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 \textbf{lower} and \textbf{upper} centimeters, inclusive, in length. The lengths will not necessarily be integers, and all possible lengths between \textbf{lower} and \textbf{upper} will be equally likely. Find the probability of you taking the \textbf{i}-th place. Note that your place number is equal to one plus the number of opponents who had longer triple jumps than you. \InputFile Consists of multiple test cases. The first line of each test case contains the values of \textbf{lower}, \textbf{upper}, \textbf{first} (\textbf{1 ≤} \textbf{lower} \textbf{≤ 1000}, \textbf{lower} \textbf{≤} \textbf{upper} \textbf{≤} \textbf{1000}, \textbf{lower} \textbf{≤} \textbf{first} \textbf{≤} \textbf{upper}) and the number of your opponents \textbf{n}. The second line contains \textbf{n} (\textbf{1 ≤} \textbf{n} \textbf{≤ 50}) integer values from \textbf{1} to \textbf{3000} - the lengths of your opponents triple jumps. \OutputFile For each test case print in a separate line exactly \textbf{n} + \textbf{1} real numbers - the probabilities of you taking the first, second, third, ..., and the last place. Note that your place number is equal to one plus the number of opponents who had longer triple jumps than you. The probabilities must be printed with \textbf{4} digits after the decimal point.
Time limit 1 second
Memory limit 64 MiB
Input example #1
1 2 1 4
1 2 3 4
1 10 5 8
1 2 3 5 10 11 12 19
Output example #1
0.5000 0.5000 0.0000 0.0000 0.0000
0.2222 0.6235 0.0556 0.0432 0.0556 0.0000 0.0000 0.0000 0.0000