Keteki Balls and Glasses
All submissions for this problem are available.Given number of red balls, number of blue balls, and number of reflective glasses print the total number of ways in which the balls can appear.
One glass can reflect one ball only. A reflected ball is taken as a real ball, so it should be counted. There won't be more glasses than total balls, all glasses should be used.
For example there is one red ball and one blue ball and one glass. So there are two possible ways for the balls to appear. Red Red Blue (one reflected red) Red Blue Blue (one reflected blue)
Input will start with a number T, the count of test cases. Each test case would contain three space separated integers, R the number of red balls, B the number of blue balls and G the number of glasses.
Print the number the number of ways in which the balls can appear for each case on a newline each.
1 1 2
3 2 2
Explanation for example 1: Both balls would be reflected so there is only one possibility.
Explanation for example 2: One example of reflection is RRRrBbB (where letters in caps are real balls, while small letters are reflected ones which should be counted too).
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions