All Tracks Math Problem

Killing Assistants
Tag(s):

Easy-Medium, Math, prob

Problem
Editorial
Analytics

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:
$$1$$ ≤ $$t$$ ≤ $$10^5$$
$$1$$ ≤ $$n$$ ≤ $$10^5$$
$$0$$ ≤ $$m$$ ≤ $$N$$

SAMPLE INPUT
3
2 1
8 5
3 3
SAMPLE OUTPUT
9/17
15/23
1/1
Explanation

.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

HackerEarth

Challenge Name

August Circuits

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications