|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|5 초||1024 MB||0||0||0||0.000%|
Alex is attending the first edition of Robotic World Championship of Table Tennis. A competition that have all of the matches having the same rules listed below:
AABBAABBAABBAABBAABB, and will be followed by
ABABAB. . . if necessary.
Experience tells that when two robots clashes into each other, the variances affecting their winning chances can be simplified to who’s serving for the point. This is due to the performances of the robots are physically consistent and won’t be affected mentally.
Alex have listed some of the possible matchups, simplified to the winning chance of each servicing point of the robots, for you. Now it is your job to help him calculate the winning chance of each match for them.
The first line of the input consists of a single number T, indicating that there will be T test cases following.
Each of the following test case consists of two space-separated real numbers PA and PB in one line, where PA denotes the Robot A’s chance of winning the point when A is serving and PB denotes the Robot B’s chance of winning the point when B is serving.
The Robot A always serves first in the very first game of the match.
For each test case, output one real number in one line: the winning chance of A.
The answer will be considered correct if it is within an absolute error of 10−8 of the correct answer.
3 1 0 0.5 0.5 0.00 1.00
1 0.5 0.000000000
The rules are revised from the Chapter 2 “The Laws of Table Tennis” of The International Table Tennis Federation (ITTF) Handbook 2020.