Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.
We all know, Argentina and Brazil supporters cannot stand each other. An organization decided to arrange a seminar about the importance of peace between football supporters. They invited $M$ Brazil supporters and $N$ Argentina supporters. They sat in a row. But if a Brazil and an Argentina supporter sat together, they fought. Even these supporters were so energetic that if one fought with his opponent on the left side and there was an opponent on the right side, he again fought. Each day the organization arranged sit differently from any previous arrangement hoping that there would be no fight. They stopped this seminar when they ran out of new permutations and realized there would never be peace between Argentina and Brazil supporters. Your task is to find out on average how many fights were there daily.
Consider all Brazil supporters are indistinguishable and the same for all Argentina supporters.
First line of the input is an integer, $t (1\leq t\leq 10000)$ number of test cases.
Each test case contains two integers, $M$ and $N$ $(1\leq M,N\leq 10^{5})$, number of Brazil and Argentina supporters.
For each test case, print the average fights per day. Absolute or Relative error should be $\leq10^{6}$.
Formally, let your answer be $a$ and the jury’s answer be $b$. Your answer is accepted if and only if $\frac{\lvert ab \lvert}{max(1,\lvert b \lvert)}\leq 10^{6}$.
Input  Output 

1 2 2  2.00000000 
Sample Explanation: BBAA = 1 BABA = 3 BAAB = 2 ABAB = 3 AABB = 1 ABBA = 2 So average fight $=\frac{1+3+2+3+1+2}{6}=2$ 
83% Solution Ratio
adnan_tokyEarliest,
hello.313Fastest, 0.0s
adnan_tokyLightest, 262 kB
mdalaminislamShortest, 102B
Login to submit
Suppose there are MMM supporters of Brazil and NNN supporters of Argentina. If all of them are made ...
Replay of CodeSpark 2021

CodeSpark 2021
