Back
Close
  • 56

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

Statement

 Goal

Raphaël has a lot of homework, but he has other plans ! Help him solve his math problems so he can go play Fortnite with his friends ...

His math teacher wants him to learn the priorities between operators and parenthesis, so he gave him some equations which are missing a couple of parenthesis.
Each equation is simple :
- no unknown variable x
- the right side contains only one number

Place the couple of parenthesis in the correct place to make the expression true.

Example :
1+3*5=20

Solution :
(1+3)*5=20
Input
1st line the number N of equations
N following lines an equation without parenthesis
Output
N correct equations
Constraints
1 ≤ N ≤ 3,
The equation contains only numbers (no x),
The right side is a single number,
There is always a solution,
There is at most one set of parenthesis,
There might be solutions without parenthesis (vicious math teacher !).
Example
Input
1
1+3*5=20
Output
(1+3)*5=20

A higher resolution is required to access the IDE