PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000081. Đếm các bội chung bán nguyên (Semi Common Multiple)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm các bội chung bán nguyên (Semi Common Multiple)
Semi Common Multiple
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
You are given positive even integers and a positive integer . Call a positive integer a semi-common multiple if, for every index , some nonnegative integer satisfies . Count the integers in that satisfy this condition.
Input
The first line contains . The next line contains the even integers .
Output
Print a single integer, the number of qualifying values .
Subtasks
-
Subtask 1 (20 points): , , và chẵn.
-
Subtask 2 (30 points): , , và chẵn.
-
Subtask 3 (50 points): , , và chẵn.
Examples
Input
2 50
6 10
Output
2
Explanation
The only qualifying values are and . Indeed, and . No other value in works.