Basketball Modeling
시간 제한2초메모리 제한2048 MB
N번의 공격 동안 2점슛과 3점슛의 성공 확률이 시도 후 오르내릴 때 얻는 총 기대 점수를 구한다.
문제
It's the start of another exciting season for Mines' women's basketball team! After crunching all of the data from previous seasons, student data scientists at Mines have identified a model that accurately predicts how many points the team will score in a game. Unfortunately, the model is rather complicated, and they need your help to crunch the numbers!
Throughout the course of a game, the team will have a positive number of discrete possessions. During each possession, the team will do one of three things: attempt a -point shot, attempt a -point shot, or make no shot attempt. On every possession, the team will attempt a -point shot with a probability of percent, and a -point shot with a probability of percent. Given that the team attempts a -point shot on their possession, they have a probability of percent that the shot is successful, scoring two points for the possession. Similarly, given that the team attempts a -point shot on their possession, they have a probability of percent that the shot is successful, scoring three points for the possession. If either type of shot attempt is unsuccessful, or no shot is attempted during a possession, it results in zero points scored for that possession. A possession ends after a shot has been made, missed, or if no shot was attempted.
The shot probabilities for the first possession, and are known. However, after missing or making a shot, the team's confidence in their ability to make that same type of shot on the next possession changes, which influences the probability of them making that shot.
Specifically, the team has known confidence adjustments and . If they attempt a -point shot on their possession and make it, then (they cannot have more than a percent chance of making a shot, of course). If they however miss the shot, then (they similarly cannot have less than a zero percent chance of making a shot). Similarly, if they attempt a -point shot on their possession and make it, then , but if they miss it, then .
If the team does not attempt a -point shot on their possession, then the shot probability for the -point shot remains unchanged for the next possession (). Similarly, if the team does not attempt a -point shot on their possession, the shot probability of the -point shot remains unchanged for the next possession (). If no shot is attempted during a possession, then neither shot type has been attempted, and both shot probabilities remain the same for the next possession.
What is the expected number of points that the team will score in total across all possessions that they will have during a game? The expected number of points is the weighted average of the number of points that the team will score in total across all possessions.
입력
The first line of input contains a single integer , the number of possessions that the team will have during a game.
The second line of input contains two space-separated integers, , and , the percent probabilities that the team attempts a -point and -point shot, respectively. Note that .
The third line of input contains two space-separated integers, , and , the percent probabilities that the team makes a -point or -point shot on their first possession, respectively.
The fourth and final line of input contains two space-separated integers, , and , the confidence adjustments for the -point and -point shots, respectively, whose definitions are provided above.
출력
Your output should be a single line, containing a single real number, the expected number of points that the team will score over the possessions. Your answer should have an absolute or relative error of at most .
힌트
In the first sample, there is a single possession. The expected number of points scored in that possession is