Number of positive integral solutions
Submissions: 346   Accuracy:

29.25%

  Difficulty: Basic   Marks: 1

You are given an equation of the form x1+x2+...+xN=K. You need to find the total number of positive integral solutions of this equation.

Input:
The first line of the input contains an integer T, denoting the number of test cases. Then T test case follows. Each testcase contains a single line that denotes the equation.

Output:

Print the total number of positive integral solutions.

Constraints:
1<=T<=100
1<=K<=25
2<=N<=10

Example:

Input:
4
a+b=5
a+b=1
a+b+c=10
a+b+c+d+e=15

Output:
4
0
36
1001

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ankit Sharma
Author: Soul_xhacker


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.