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ớ:
256M
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
Given an array ~ A ~ consisting of ~ N ~ positive integers, the task is to find the smallest positive integer ~ D ~ such that ~ D > 1 ~ and all elements in the array are divisible by ~ D ~.
Input
- The first line contains a positive integer ~ N ~ (~ N \leq 10^5 ~).
- The second line contains ~ N ~ positive integers ~ A_1, A_2, \ldots, A_N ~ (~ A_i \leq 10^{10} ~).
Output
- A single integer which is the smallest common divisor greater than ~1~ of the array. If no such divisor exists, print ~-1~.
Sample Input
3
2 4 6
Sample Output
2
Bình luận