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
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Given an array ~A~ of ~N~ prime numbers: ~A_1, A_2, ..., A_N~, a beautiful number is a number that is divisible by at least one prime number in the array ~A~.
Task: Given the integer ~N~ and the array ~A~, count the number of beautiful numbers that do not exceed ~M~.
Input:
- The first line contains two integers ~N~ and ~M~ (~1 ≤ N ≤ 20~);
- The second line contains the sequence of integers ~A_1, A_2, ..., A_N~. The numbers are separated by spaces.
Output:
- A single integer representing the number of beautiful numbers.
Sample Input
2 11
3 5
Sample Output
5
Notes
- The beautiful numbers are: ~3, 5, 6, 9, 10~.
Constraints
- ~60\%~ of the test cases correspond to ~1 ≤ M ≤ 10^6~, ~1 ≤ A_i ≤ 10^5~;
- ~20\%~ of the test cases correspond to ~1 ≤ M ≤ 10^9~, ~10^5 < A_i ≤ 10^9~;
- ~20\%~ of the test cases correspond to ~1 ≤ M ≤ 10^{18}~, ~1 ≤ A_i ≤ 10^{18}~.
Bình luận