Killing Assistants
Practice
2.9 (25 votes)
Mathematics
Prob
Easy Medium
Problem
78% Success 3745 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

The fictional university of ZombieLand - has n students volunteer for the role of Killing Assistants, student volunteers who help in smooth killing of zombies in the campus. Every student can either manage to shoot a zombie or miss it.

Out of these n Killing Assistants, m students try to shoot the zombie fairly, that is, they are unbiased, while the rest of them are biased. The probability that a zombie will be hit by a shot if the Killing Assistant is biased is \(2/3\), otherwise the probability is \(1/2\).

Little Harry figures out this mess by selecting a Killing Assistant randomly. He tricks that particular Killing Assistant in shooting the same zombie twice. The first time, the Killing Assistant shoots the zombie, while the other time, he ends up missing it.

Harry wants to know what are the chances that the selected Killing Assistant was NOT biased.

Input format:
The first line consists of a number t, which denotes the number of test cases. For every test case, there will be two integers on the next line. The number n denoting the number of students, while the number m denotes the number of unbiased students.

Output format:
For every test case, print the required probability in the form of a reduced fraction possible. More formally, print the desired probability as P/Q, where P and Q are coprime.

Constraints:
1t\(10^5\)
1n\(10^5\)
0mN

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
No similar problems found
Editorial

Login to unlock the editorial