Lalit and Kundu
Practice
0 (0 votes)
Mathematics
Medium
Open
Approved
Probability and statistics
Problem
75% Success 420 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Little Lalit is an extremely good competitive coder. But recently, he was challenged by another fellow competitive programmer called Little Kundu. Lalit decides to challenge Kundu to prove that he's better than him.

After a tough grueling competitive fight, Lalit manages to beat Kundu. Let us give you some statistics from the contest. Lalit managed to solve only a problems, while Kundu solved b problems.

But, Lalit is not just satisfied with his victory over Kundu now. Lalit wants to know the probability that his number of questions solved in the contest were strictly more than Kundu throughout the contest.

Help Lalit in finding the probability for the same.

Input format:
The first line contains the number of test cases. Then, every single line will contain two integers a and b, denoting the number of problems solved by Lalit and Kundu.

Output format:
For each test case print the required probability. The answer will be considered correct if its absolute or relative error doesn't exceed 10-6.

Constraints:
1 ≤ Test Cases ≤ 1000
1 ≤ A ≤ 105
1 ≤ B < A

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
21 votes
Tags:
MediumApprovedReadyMathematicsOpenProbability and Statistics