6839.Common Divisors

Time Limit: 1s Memory Limit: 512MB

You are given an array of $n$ positive integers. Your task is to find two integers such that their greatest common divisor is as large as possible.

Input Format(From the terminal/stdin)

The first input line has an integer $n$ : the size of the array.

The second line has $n$ integers $x_1,x_2,\ldots,x_n$ : the contents of the array.

  • $2 \le n \le 2 \cdot 10^5$
  • $1 \le x_i \le 10^6$

Output Format(To the terminal/stdout)

Print the maximum greatest common divisor.

Sample Input

Copy
5
3 14 15 7 9
 \n
 ·  ·  · · \n

Sample Output

Copy
7
 \n
Source: CSES, Mathematics, 1081

Submit

请先 登录

© 2025 FAQs