Semi Common Multiple
Xem dạng PDF
Gửi bài giải
Điểm:
5,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
512M
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
Reference: AtCoder ABC150 D — Semi Common Multiple
You are given a sequence ~A~ of ~N~ positive even integers:
~a_1, a_2, \ldots, a_N~
and an integer ~M~.
A positive integer ~X~ is called a semi-common multiple of ~A~ when, for every ~k~ from ~1~ to ~N~, there exists a non-negative integer ~p~ such that:
~X = a_k \times (p + 0.5)~
Find the number of semi-common multiples of ~A~ between ~1~ and ~M~, inclusive.
Input
- The first line contains two integers ~N~ and ~M~.
- The second line contains ~N~ integers: ~a_1, a_2, \ldots, a_N~.
Output
- Print the number of semi-common multiples between ~1~ and ~M~, inclusive.
Constraints
- ~1 \le N \le 10^5~
- ~1 \le M \le 10^9~
- ~2 \le a_i \le 10^9~
- Every ~a_i~ is even, and all input values are integers.
Example 1
Input:
2 50
6 10
Output:
2
Bình luận