A higher resolution is required to access the IDE
- 6
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
This puzzle is a BONUS exercise associated with a multi-part Algorithm X tutorial and is meant to be done per the guidance in the following playground:Although you may use any language you wish to complete this puzzle, the playground is written for the Python programmer. Most importantly, the reusable Algorithm X Solver provided in the playground is written in Python. If you follow the directions in the playground and use Python, this puzzle should be significantly easier than if you choose another language or algorithm.
Task Overview:
You have to make n equations.
The left side of each equation contains 2 operands, chosen from
Operands on the left side of each equation must be in ascending order from left to right and must have either a
If solutionCount = 1, you must print the equations in ascending order of the right side of the equation. All components of the equation (operands, operators, equal sign, constants) must be space separated.
Credit: This puzzle has been inspired by a puzzle found in an adventure game called “Mystery Detective Adventure” made by Five-BN Games.
Input
Line 1: An integer n, the number of equations in a solution.
Line 2: rightSides - n unique, space-separated integers to be used on the right sides of the solution equations.
Line 3: operandOccurrenceCounts - 9 space-separated integers indicating how many times each number from1 to 9 must occur as an operand.
Line 2: rightSides - n unique, space-separated integers to be used on the right sides of the solution equations.
Line 3: operandOccurrenceCounts - 9 space-separated integers indicating how many times each number from
Output
Line 1: solutionCount - the number of unique solutions to the given input.
if solutionCount = 1, output:
Next n Lines: The equations that make up the solution, sorted per the instructions above.
if solutionCount = 1, output:
Next n Lines: The equations that make up the solution, sorted per the instructions above.
Constraints
• 2 <= n <= 15.
• 4 <= each value in rightSides <= 28.
• 0 <= each value in operandOccurrenceCounts <= 6.
• 4 <= each value in rightSides <= 28.
• 0 <= each value in operandOccurrenceCounts <= 6.
Example
Input
3 5 7 10 1 1 1 1 1 0 0 1 0
Output
1 1 x 5 = 5 3 + 4 = 7 2 + 8 = 10
A higher resolution is required to access the IDE