SOLVE

LATER

Win-the-Game

Problem

Editorial

Analytics

Two friends Kunal and Satyam are playing an interesting game. They take turns drawing a ball from a bag which initially contains R red balls and G green balls. Each player draws a ball alternatively and never put it back. The person who is the first to draw a red balls wins. Satyam always draws first. If there are no more balls in the bag and nobody has drawn a red ball, the satyam wins.

What is the probability of the Satyam winning?

Input:

The first line will contain the number of test cases T.

The first line of each test case will contain a number R (number of red balls) and G(number of green balls )

Output

For each testcase, print the desired probability.

Constraints:

1<=T<=10

0<=R,G<=10^3

Problem Setter : Surya Pratap Singh

Time Limit:
2.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

Initializing Code Editor...

{"81575af": "/pagelets/recommended-problems/algorithm/win-the-game/", "8157566": "/pagelets/show-submission/algorithm/win-the-game/", "8157587": "/pagelets/suggested-problems/algorithm/win-the-game/", "8157596": "/pagelets/problem-author-tester/algorithm/win-the-game/", "81575a4": "/pagelets/problems-hint/algorithm/win-the-game/"}

realtime.hackerearth.com

80

390611c94778306b5e3a7b3984cb408c508bb2f6

58a29e5cae2309f04b28

/realtime/pusher/auth/