2156 - Ping Pong Probability 2156 - Ping Pong Probability 2156 - Ping Pong Probability

Statistics Sub: 160 | AC: 88 | AC%: 55,00 | Score: 1,68
Created by Vladimir Antonio Charchabal Escalona
Added by lgvallejo (2012-11-20)
Limits
Total Time: 10000 MS | Test Time: 2000 MS |Memory: 62 MB | Output: 64 MB | Size: 30 KB
Enabled languages
Available in

Description

Two Ping Pong players agree to play several games. The players are evenly matched. However, the person serving first has a probability p of winning that game. A serves the first game and thereafter the loser serves first. What is the Probability that A wins the n-th game?
Two Ping Pong players agree to play several games. The players are evenly matched. However, the person serving first has a probability p of winning that game. A serves the first game and thereafter the loser serves first. What is the Probability that A wins the n-th game?
Two Ping Pong players agree to play several games. The players are evenly matched. However, the person serving first has a probability p of winning that game. A serves the first game and thereafter the loser serves first. What is the Probability that A wins the n-th game?

Input specification

Number of test cases T followed by T lines of 'n' - the number of games played; and 'p' probability of person serving first winning (0 < T, n < 100).
;jsessionid=96AF391FC2BE9F8412183D1015D5613B
Number of test cases T followed by T lines of 'n' - the number of games played; and 'p' probability of person serving first winning (0 < T, n < 100).
;jsessionid=96AF391FC2BE9F8412183D1015D5613B
Number of test cases T followed by T lines of 'n' - the number of games played; and 'p' probability of person serving first winning (0 < T, n < 100).
;jsessionid=96AF391FC2BE9F8412183D1015D5613B

Output specification

Print for each test case the probability of A winning. The number must have a precision of 5 decimal digits.
Print for each test case the probability of A winning. The number must have a precision of 5 decimal digits.
Number of test cases T followed by T lines of 'n' - the number of games played; and 'p' probability of person serving first winning (0 < T, n < 100).
;jsessionid=96AF391FC2BE9F8412183D1015D5613B

Sample input

2
4 0.7
7 0.7

Sample output

0.48720
0.50082

Hint(s)

http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/

Recommendation

We have carefully selected several similar problems: 2243 | 3479 | 1811 | 2141 | 1650 | 4105