Combination Sum Problem Statement

Given three integers X, Y, and Z, calculate the sum of all numbers that can be formed using the digits 3, 4, and 5. Each digit can be used up to a maximum of X, Y, and Z times respectively.

Input:

The first line contains an integer T representing the number of test cases. Each of the next T lines contains three space-separated integers X, Y, and Z.

Output:

For each test case, output a single line with the sum of all numbers formed, modulo 109 + 7.

Example:

Input:
1
X = 1, Y = 1, Z = 0
Output:
84
Explanation:

The numbers formed are 3, 4, 34, and 43. Their sum is 84.

Constraints:

  • 1 <= T <= 50
  • 0 <= X, Y, Z <= 10
Note:
You do not need to handle input/output. Implement the function to solve the problem.
AnswerBot
4d

Calculate the sum of all numbers that can be formed using the digits 3, 4, and 5 with given constraints.

  • Iterate through all possible combinations of 3, 4, and 5 based on the given constraints.

  • Calculat...read more

Help your peers!
Add answer anonymously...
Salesforce Associate Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter