当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6025:Coprime Sequence

题目描述
Do you know what is called ``Coprime Sequence''? That is a sequence consists of $n$ positive integers, and the GCD (Greatest Common Divisor) of them is equal to 1.
``Coprime Sequence'' is easy to find because of its restriction. But we can try to maximize the GCD of these integers by removing exactly one integer. Now given a sequence, please maximize the GCD of its elements.
输入解释
The first line of the input contains an integer $T(1\leq T\leq10)$, denoting the number of test cases.
In each test case, there is an integer $n(3\leq n\leq 100000)$ in the first line, denoting the number of integers in the sequence.
Then the following line consists of $n$ integers $a_1,a_2,...,a_n(1\leq a_i\leq 10^9)$, denoting the elements in the sequence.
输出解释
For each test case, print a single line containing a single integer, denoting the maximum GCD.
输入样例
3
3
1 1 1
5
2 2 2 3 2
4
1 2 4 8
输出样例
1
2
2
来自杭电HDUOJ的附加信息
Recommend jiangzijing2015

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6025

最后修改于 2020-10-25T23:27:39+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)