아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Loot Chest

시간 제한1초메모리 제한1024 MB

요약
승패에 따라 상금 확률이 변할 때 목표 아이템을 얻기까지 치러야 할 경기 수의 기댓값을 구한다.
난이도

보통10점 중 7점

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

문제

Your favorite online game has a prize system. After each match you win, there is a PP\\% chance you will receive a prize. This value PP changes over time:

  • every time you lose a match, PP increases by Δ_L\Delta\_L,
  • every time you win a match but fail to receive a prize, PP increases by Δ_W\Delta\_W, and
  • every time you win a match and receive a prize, PP is set to 00.

Whenever PP is increased, it is capped at 100100. That is, if PP is to be increased by Δ\Delta, PP increases to min⁡(P+Δ,100)\min(P+\Delta, 100).

The developers just revealed one of the prizes this season is a silverback gorilla suit with star-shaped sunglasses. You want it! Each prize has a GG\\% chance of being this gorilla suit.

You start with P=0P = 0\\%. You have an LL\\% chance of losing each match you play. Given Δ_L,Δ_W,G,\Delta\_L, \Delta\_W, G, and LL, compute the expected number of matches you will have to play until you obtain the silverback gorilla suit.

For example, in the first sample case you win every match you play and are guaranteed to receive a prize every 22 matches. Each prize has a 5050\\% chance of being the gorilla suit. So you expect to obtain the gorilla suit after receiving 22 prizes. Thus, in expectation, it takes 44 matches to obtain the gorilla suit.

입력

The input consists of a single line containing four integers Δ_L\Delta\_L (1≤Δ_L≤1001 \leq \Delta\_L \leq 100), Δ_W\Delta\_W (1≤Δ_W≤1001 \leq \Delta\_W \leq 100), GG (1≤G≤1001 \leq G \leq 100), and LL (0≤L≤990 \leq L \leq 99), which are described above.

출력

Display the expected number of matches you will play before you obtain the gorilla suit. Your answer should have an absolute or relative error of at most 10−610^{-6}.

예제4

  1. 예제 1

    입력
    1 100 50 0
    
    예상 출력
    4
    
  2. 예제 2

    입력
    50 50 100 25
    
    예상 출력
    2.8333333333333333333
    
  3. 예제 3

    입력
    1 100 10 0
    
    예상 출력
    20
    
  4. 예제 4

    입력
    2 3 10 80
    
    예상 출력
    197.00570671995630567