PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000233. Số nhỏ nhất không nguyên tố cùng nhau (Not coprime)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Số nhỏ nhất không nguyên tố cùng nhau (Not coprime)
Số nhỏ nhất không nguyên tố cùng nhau (Not coprime)
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
Given pairwise distinct integers between 2 and 50, find the smallest positive integer such that for every .
Input
- First line: integer .
- Second line: array elements. All elements must be distinct.
Output
Print the smallest positive integer .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
2
4 3
Output
6
Explanation
The result must have a factor of 2 and a factor of 3, giving 6.
Example 2
Input
1
47
Output
47
Explanation
To share a nontrivial divisor with 47, the smallest possible value is 47.