PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000117. Số chia hết nhiều nhất (Almost GCD)
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ố chia hết nhiều nhất (Almost GCD)
Almost GCD
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
Given positive integers , define the divisibility score of an integer as the number of array elements divisible by . Print an integer with the maximum score; any maximizer is accepted.
Input
The first line contains ; the second line contains integers .
Output
Print any integer that maximizes the divisibility score.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
3
3 12 7
Output
3
Explanation
divides both and , giving a count of 2, which is optimal.