Proficiency
Time limit2sMemory limit512 MB
Given two counters with geometric service times, find the probability that all L1 people finish before all L2 people do.
- Level
Medium7 of 10
- Topics
- Probability, Dynamic programming, Math
- Solved
- No attempts yet
Problem
Yeongseon has finished shopping and walks to the checkout. There are two counters. people stand in line at counter 1 and people stand in line at counter 2. Each clerk serves the person at the front of the line, one person at a time.
The time a clerk needs for one person depends on the clerk's proficiency. A clerk with proficiency finishes one person in exactly seconds with probability . The clerk at counter 1 has proficiency , the clerk at counter 2 has proficiency , and the times are independent across people.
Given , , , , compute the probability that standing in line at counter 1 is better than standing in line at counter 2. That is the probability that the last person in line 1 finishes before the last person in line 2. Finishing in the same second does not count as finishing first.
Input
The first line contains , , , separated by spaces. ()
Output
Print the probability that the last person at counter 1 finishes before the last person at counter 2, rounded to nine decimal places. Always print exactly nine digits after the decimal point. If comes up while computing the probability, treat it as 1.