Basketball Modeling

시간 제한2초메모리 제한2048 MB

요약
N번의 공격 동안 2점슛과 3점슛의 성공 확률이 시도 후 오르내릴 때 얻는 총 기대 점수를 구한다.
난이도

보통10점 중 6점

유형
확률, 동적 계획법, 수학
정답자
아직 제출이 없습니다

문제

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 22-point shot, attempt a 33-point shot, or make no shot attempt. On every possession, the team will attempt a 22-point shot with a probability of A_2A\_2 percent, and a 33-point shot with a probability of A_3A\_3 percent. Given that the team attempts a 22-point shot on their ithi^{\text{th}} possession, they have a probability of M_2,iM\_{2, i} percent that the shot is successful, scoring two points for the possession. Similarly, given that the team attempts a 33-point shot on their ithi^{\text{th}} possession, they have a probability of M_3,iM\_{3, i} 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, M_2,1M\_{2, 1} and M_3,1M\_{3, 1} 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 C_2C\_2 and C_3C\_3. If they attempt a 22-point shot on their ithi^{\text{th}} possession and make it, then M_2,i+1=min⁡(M_2,i+C_2,100)M\_{2, i + 1} = \min(M\_{2, i} + C\_2, 100) (they cannot have more than a 100100 percent chance of making a shot, of course). If they however miss the shot, then M_2,i+1=max⁡(M_2,i−C_2,0)M\_{2, i + 1} = \max(M\_{2, i} - C\_2, 0) (they similarly cannot have less than a zero percent chance of making a shot). Similarly, if they attempt a 33-point shot on their ithi^{\text{th}} possession and make it, then M_3,i+1=min⁡(M_3,i+C_3,100)M\_{3, i + 1} = \min(M\_{3, i} + C\_3, 100), but if they miss it, then M_3,i+1=max⁡(M_3,i−C_3,0)M\_{3, i + 1} = \max(M\_{3, i} - C\_3, 0).

If the team does not attempt a 22-point shot on their ithi^{\text{th}} possession, then the shot probability for the 22-point shot remains unchanged for the next possession (M_2,i+1=M_2,iM\_{2, i + 1} = M\_{2, i}). Similarly, if the team does not attempt a 33-point shot on their ithi^{\text{th}} possession, the shot probability of the 33-point shot remains unchanged for the next possession (M_3,i+1=M_3,iM\_{3, i + 1} = M\_{3, i}). 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 NN 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 NN possessions.

입력

The first line of input contains a single integer 1≤N≤1001 \leq N \leq 100, the number of possessions that the team will have during a game.

The second line of input contains two space-separated integers, 0≤A_2≤1000 \leq A\_2 \leq 100, and 0≤A_3≤1000 \leq A\_3 \leq 100, the percent probabilities that the team attempts a 22-point and 33-point shot, respectively. Note that 0≤A_2+A_3≤1000 \leq A\_2 + A\_3 \leq 100.

The third line of input contains two space-separated integers, 0≤M_2,1≤1000 \leq M\_{2, 1} \leq 100, and 0≤M_3,1≤1000 \leq M\_{3, 1} \leq 100, the percent probabilities that the team makes a 22-point or 33-point shot on their first possession, respectively.

The fourth and final line of input contains two space-separated integers, 0≤C_2≤1000 \leq C\_2 \leq 100, and 0≤C_3≤1000 \leq C\_3 \leq 100, the confidence adjustments for the 22-point and 33-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 NN possessions. Your answer should have an absolute or relative error of at most 10−610^{-6}.

힌트

In the first sample, there is a single possession. The expected number of points scored in that possession is 2⋅50100⋅40100+3⋅30100⋅20100=0.582 \cdot \frac{50}{100} \cdot \frac{40}{100} + 3 \cdot \frac{30}{100} \cdot \frac{20}{100} = 0.58

예제2

  1. 예제 1

    입력
    1
    50 30
    40 20
    5 10
    
    예상 출력
    0.58
    
  2. 예제 2

    입력
    3
    70 20
    60 40
    5 10
    
    예상 출력
    3.26279