Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 300 点
問題文
N 個の 2 以上 50 以下の整数 X_1, X_2, \cdots, X_N が与えられます.全ての i = 1, 2, \cdots, N について次の条件を満たす正の整数 Y のうち,最小のものを求めてください.
- X_i と Y は互いに素でない
制約
- 1 \leq N \leq 49
- 2 \leq X_i \leq 50
- X_i \neq X_j (i \neq j)
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる.
N X_1 X_2 \ldots X_N
出力
条件を満たす最小の正の整数を出力せよ.
入力例 1
2 4 3
出力例 1
6
4 と互いに素でないためには偶数である必要があり,3 と互いに素でないためには 3 の倍数である必要があります.
入力例 2
1 47
出力例 2
47
入力例 3
7 3 4 6 7 8 9 10
出力例 3
42
Score : 300 points
Problem Statement
Given are N integers between 2 and 50 (inclusive): X_1, X_2, \cdots, X_N. Find the minimum positive integer Y that satisfies the following for every i = 1, 2, \cdots, N:
- X_i and Y are not coprime.
Constraints
- 1 \leq N \leq 49
- 2 \leq X_i \leq 50
- X_i \neq X_j (i \neq j)
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
N X_1 X_2 \ldots X_N
Output
Print the minimum positive integer that satisfies the condition.
Sample Input 1
2 4 3
Sample Output 1
6
Being not coprime with 4 requires being even, and being not coprime with 3 requires being a multiple of 3.
Sample Input 2
1 47
Sample Output 2
47
Sample Input 3
7 3 4 6 7 8 9 10
Sample Output 3
42