Please enter your email address or userHandle.
There are ‘p’ balls of type P, ‘q’ balls of type Q and ‘r’ balls of type R. Using the balls we want to create a straight line such that no two balls of same type are adjacent.
First line of input contains number of test cases T. Each line of test case contains number of balls of each type seperated by a single space.
Number of ways to arrange balls are displayed and 0 is displayed if there are no ways.
1 <= T <= 30
1 <= p,q,r <= 9
2 2 2
1 1 1
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.