bzoj#P4429. [Nwerc2015] Elementary Math 小学数学
[Nwerc2015] Elementary Math 小学数学
题目描述
Ellen is teaching elementary math to her students and the time for the final exam has come. The exam consists of questions. In each question the students have to add (+), subtract (−) or multiply (∗) a pair of numbers.
Ellen has already chosen the pairs of numbers. All that remains is to decide for each pair which of the three possible operations the students should perform. To avoid students getting bored, Ellen wants to make sure that the correct answers to her exam are all different.
Please help Ellen finish constructing the exam by automating this task.
输入格式
The input consists of:
- one line with one integer , the number of pairs of numbers;
- lines each with two integers and , a pair of numbers used.
输出格式
For each pair of numbers in the same order as in the input, output a line containing a valid equation. Each equation should consist of five parts: , one of the three operators, , an equals sign (=), and the result of the expression. All the expression results must be different.
If there are multiple valid answers you may output any of them. If there is no valid answer, output a single line with the string “impossible” instead.
4
1 5
3 3
4 5
-1 -6
1+5=6
3*3=9
4-5=-1
-1--6=5
4
-4 2
-4 2
-4 2
-4 2
impossible
数据范围与约定
For of the data, ,。