UVA-10056 - What is the Probability?

  • UVa Online Judge 解題結果請於 Submit 後,參閱 uHunt
  • 如果你有任何建議與指教,歡迎於下方留言一起討論喔!
  • 本題選為「20170523 大學程式能力檢定 CPE」題目。

題意概要

題目給定全部人數、每個人獲勝的機率,並給定所要求第幾個人獲勝的機率。


Input

Input will contain an integer () at first, which indicates how many sets of inputs are there. The next lines will contain sets of inputs. Each line contain an integer () which denotes the number players, a floating point number which indicates the probability of the happening of a successful event in a single throw (If success means getting then is the probability of getting in a single throw. For a normal dice the probability of getting is ), and () the serial of the player whose winning probability is to be determined (Serial no varies from to ). You can assume that no invalid probability () value will be given as input.


Output

For each set of input, output in a single line the probability of the -th player to win. The output floating point number will always have four digits after the decimal point as shown in the sample output.


Sample Input

2
2 0.166666 1
2 0.166666 2

Sample Output

0.5455
0.4545
profile-image
Yung-Sheng Lu
Hello, I'm Yung-Sheng Lu. I am a graduate student in Department of Computer Science at National Chiao Tung University, Taiwan. I am in the Networking and Sensing Systems (NSS) Lab at NCTU.
comments powered by Disqus