#Lutece0113. Intricate Ballgame
Intricate Ballgame
Migrated from Lutece 113 Intricate Ballgame
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Three students are playing a game in their spare time. Student A and Student C are in one team (Student A can be used to refer to this team), Student B himself is the other team. Behind Student B there's a chair, and Student C is keeping a goal behind him. Student A repeatedly throws a ball in the direction of Student B, and Student B aims to defend the chair
, that is to kick the ball thrown to the chair away, and if possible, to kick into the goal Student C keeps. The playing field has lines, including the goal line, the area among which is counted as in play. The detailed rule of the game is:
- if Student B does not try to kick the ball, just let the ball pass
- if the ball hits the chair, Student A get point.
- else, Student B get point
- if Student B tries to kick the ball
- if he misses the ball, then Student A get point, regardless of the ball hits the chair or not
- if he contacts(not misses) the ball
1. if the ball is kicked into the goal Student C keeps, then Student B wins the game.
2. if the ball is caught by Student C in play, then Student A wins the game.
3. if the ball is out of play(regardless of it is directly kicked out of play, or deflected out of play by Student C)
- if Student A has already points scored, then both sides do not score.
- else, Student A get point.
- if Student A scores points, then he wins; if Student B scores points, then he wins
- the game will go on indefinitely until one side win the game.
Now you have information below(thats also the input):
- the
out of play
percentage of Student B, that means the proportion of balls kicked out of play among balls contacted by Student B. - the goalkeeping success rate of Student C: that means when ball in play(scenarios
2.2.1
and2.2.2
), the conditional probability that Student A wins the game - the throwing accuracy of Student A: that means if Student B always do not try to kick the ball, the percentage of balls that hit the chair.
- the
ball selection
accuracy of Student B: when the ballwill hit the chair if not kicked
, the probability the Student B tries to kick this ball. - the
ball selection
mistake rate accuracy of Student B: when the ballwill not hit the chair if not kicked
, the probability the Student B tries to kick this ball. - the ball kicking contact rate of Student B: when Student B tries to kick the ball, the probability he contacts (not misses) the ball.
Assume these probabilities are same in every kick.
Your mission is to calculate the probability that Student A wins the game.
Input
The first line of the input contains one integer , which indicate the number of test cases.
One line per test case, a to f according to the order above, blank separated. All input numbers have digits after decimal point.
Output
One line per test case, indicating the probability that Student A wins the game. Output digits (%.3f
) after the decimal point.
Samples
1
0.2530 0.2696 0.5530 0.5610 0.2350 0.8430
0.379
Resources
The 7th UESTC Programming Contest Final