CSES - Common Divisors
Xem dạng PDF
Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
512M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
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
- 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.
Output
- Print the maximum greatest common divisor.
Constraints
- ~2 \le n \le 2 \cdot 10^5~
- ~1 \le x\_i \le 10^6~
Example Input
5
3 14 15 7 9
Example Output
7
Bình luận