#C2031. Alphanumeric Password Probability
Alphanumeric Password Probability
Alphanumeric Password Probability
You are given several test cases. In each test case, you are provided with an integer n representing the number of login attempts. For each attempt, you are given a pair of integers Pi and Ci. The integer Pi represents the chance (in percentage) that the attempt will yield an alphanumeric password. Note that Ci is also provided as an identifier (0 or 1) but is not used in the calculation.
Your task is to compute the probability that the next login attempt produces an alphanumeric password. Mathematically, for a given test case with n attempts, the probability is calculated as:
$$\text{Probability} = \frac{1}{n}\sum_{i=1}^{n} \frac{P_i}{100} $$Output the probability for each test case rounded to 9 decimal places.
inputFormat
The first line contains an integer T
, the number of test cases. For each test case, the first line contains an integer n
, the number of login attempts. This is followed by n
pairs of integers Pi
and Ci
separated by spaces.
outputFormat
For each test case, print the computed probability on a new line. The probability must be rounded to 9 decimal places.
## sample4
3
70 1 30 0 50 1
2
45 0 90 1
4
100 1 100 1 100 1 100 1
4
0 0 0 0 0 0 0 0
0.500000000
0.675000000
1.000000000
0.000000000
</p>