QOJ.ac

QOJ

Limite de temps : 3 s Limite de mémoire : 128 MB Points totaux : 100

#3691. 最小公倍数

Statistiques

Byteasar 正在为一场数学考试做准备,考试的重点是确定最小公倍数。回想一下,整数 $a_1, a_2, \dots, a_k$ 的最小公倍数 (lcm) 是使得 $a_1, a_2, \dots, a_k$ 中的每一个都是其约数的最小正整数 $d$。例如,$\text{lcm}(8, 12) = 24$,而 $\text{lcm}(2, 3, 4) = 12$。

Byteasar 很快掌握了标准练习,并发现这个主题非常有趣,于是他开始自己发明题目。让我们看看你是否能解决其中一道。

对于给定的正整数 $M$,你需要返回一个正整数区间 $[a, b]$,使得该区间内所有整数的最小公倍数恰好为 $M$。区间 $[a, b]$ 必须包含至少两个正整数。

为了全面测试你的技能,Byteasar 将向你(或者说你的程序)提出多个询问。

输入格式

输入的第一行包含一个整数 $z$ ($z \ge 1$),表示 Byteasar 的询问次数。接下来的 $z$ 行指定了询问,每行一个。每个询问由一个整数 $M$ ($M \ge 1$) 指定。

输出格式

你的程序应向标准输出打印恰好 $z$ 行。第 $i$ 行应包含第 $i$ 个询问的答案。答案由两个正整数 $a$ 和 $b$ 组成,中间用空格隔开,表示整数区间 $[a, b]$。

如果不存在满足所需属性的区间,则应打印单词 NIE(波兰语中的“不”),而不是任何数字。

如果存在多个答案,请报告 $a$ 最小的那一个;若 $a$ 相同,则选择 $b$ 较小的那一个。

样例

样例输入 1

3
12
504
17

样例输出 1

1 4
6 9
NIE

说明

对于第一个询问,数字 12 是区间 $[2, 4]$(包含 2, 3, 4)的最小公倍数,但也是区间 $[1, 4]$(包含 1, 2, 3, 4)的最小公倍数。第二个区间的 $a$ 更小。

子任务

测试集由以下子任务组成。每个子任务内可能包含多个测试点。

子任务 条件 分值
1 $z \le 10, M \le 1000$ 18
2 $z \le 100, M \le 10^9$ 20
3 $z \le 100, M \le 10^{18}$ 20
4 $z \le 10\,000, M \le 10^{18}$ 42

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.