A1132 | [COCI-2007_2008-contest6]#2 GRANICA
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Luka started driving international routes with his truck. His biggest problem is the border with Slovenia. The border is a point of entrance into the European Union, so every truck is thoroughly examined. Because of this, Luka always has to wait several hours there. To kill the time, he comes up with various logic and math games.
In one of them, Luka first reads the numbers off of N license plates and writes them down on a piece of paper. Then he tries to find an integer M greater than 1 such that all integers on the paper give the same remainder when divided by M. Luka tries to find as many such integers M as possible.
Write a program that, given Luka's N integers, determines all such integers M.
In one of them, Luka first reads the numbers off of N license plates and writes them down on a piece of paper. Then he tries to find an integer M greater than 1 such that all integers on the paper give the same remainder when divided by M. Luka tries to find as many such integers M as possible.
Write a program that, given Luka's N integers, determines all such integers M.
输入格式
The first line contains the integer N (2 ≤ N ≤ 100), the number of integers on paper.
Each of the following N lines contains one integer between 1 and 1 000 000 000 (one billion). All these integers will be distinct.
The input data will guarantee that at least one integer M will always exist.
Each of the following N lines contains one integer between 1 and 1 000 000 000 (one billion). All these integers will be distinct.
The input data will guarantee that at least one integer M will always exist.
输出格式
Output all integers M separated by spaces, in any order.
输入输出样例
输入 #1
3 6 34 38
输出 #1
2 4
输入 #2
5 5 17 23 14 83
输出 #2
3
In test cases worth 60% points, each of the N numbers will be at most 10000.
In the first example, all integers give a remainder of 0 when divided by 2 and the remainder 2 when
divided by 4.
In the first example, all integers give a remainder of 0 when divided by 2 and the remainder 2 when
divided by 4.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted