QOJ.ac

QOJ

Limite de temps : 10 s Limite de mémoire : 1024 MB Points totaux : 100

#3108. 基础数学

Statistiques

Ellen 正在教她的学生基础数学,期末考试的时间到了。考试包含 $n$ 道题目。在每一道题中,学生需要对一对数字进行加法($+$)、减法($-$)或乘法($*$)运算。

Ellen 已经选好了 $n$ 对数字。现在剩下的工作是为每一对数字决定学生应该执行三种运算中的哪一种。为了避免学生感到枯燥,Ellen 希望确保考试中 $n$ 个正确的答案各不相同。

请通过自动化此任务来帮助 Ellen 完成考试的构建。

输入格式

输入包含: 一行一个整数 $n$ ($1 \le n \le 2\,500$),表示数字对的数量; $n$ 行,每行包含两个整数 $a$ 和 $b$ ($-10^6 \le a, b \le 10^6$),表示使用的一对数字。

输出格式

对于每一对数字 $(a, b)$,按照输入中的顺序,输出一行包含一个有效等式的字符串。每个等式应由五个部分组成:$a$、三个运算符之一、$b$、一个等号($=$)以及表达式的结果。所有 $n$ 个表达式的结果必须各不相同。

如果存在多个有效答案,你可以输出其中任意一个。如果没有有效的答案,则输出一行字符串 “impossible”。

Ellen 的考试示例

样例

样例输入 1

4
1 5
3 3
4 5
-1 -6

样例输出 1

1 + 5 = 6
3 * 3 = 9
4 - 5 = -1
-1 - -6 = 5

样例输入 2

4
-4 2
-4 2
-4 2
-4 2

样例输出 2

impossible

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.