QOJ.ac

QOJ

시간 제한: 1.0 s 메모리 제한: 32 MB 총점: 50

#17128. 余数

통계

Luka 开始驾驶卡车跑国际路线。他最大的麻烦是与斯洛文尼亚的边境。由于该边境是进入欧盟的通道,每辆卡车都要接受彻底的检查。因此,Luka 总是要在那里等待数小时。为了消磨时间,他想出了各种逻辑和数学游戏。

在其中一个游戏中,Luka 首先读出 $N$ 张车牌上的数字,并将它们写在一张纸上。然后,他试图寻找一个大于 1 的整数 $M$,使得纸上的所有整数在除以 $M$ 时都得到相同的余数。Luka 试图寻找尽可能多的这样的整数 $M$。

编写一个程序,在给定 Luka 的 $N$ 个整数的情况下,确定所有这样的整数 $M$。

输入格式

第一行包含整数 $N$($2 \le N \le 100$),表示纸上整数的个数。

接下来的 $N$ 行,每行包含一个介于 $1$ 和 $1\,000\,000\,000$ 之间的整数。所有这些整数都是互不相同的。

输入数据保证至少存在一个满足条件的整数 $M$。

输出格式

输出所有满足条件的整数 $M$,用空格隔开,可以以任意顺序输出。

子任务

在占总分 60% 的测试数据中,这 $N$ 个数中的每一个都最大不超过 $10000$。

样例

输入样例 1

3
6
34
38

输出样例 1

2 4

输入样例 2

5
5
17
23
14
83

输出样例 2

3

说明

在第一个样例中,所有整数除以 2 的余数均为 0,除以 4 的余数均为 2。

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.