1514: 幸运数
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:32
Solved:17
Description
新年到来,许多幸运数正等待着有缘者去寻找,现在定义一个幸运数满足:
$ (1) $ $ x \in \left [ l , r \right] (1 \le l \le r \le 10^9)$
$ (2) $ $ \exists $ $ i \in [1, n]$ $有 a_i \mid x (表示x 被 a_i 整除)$
问一共有多少个幸运数?
$ (1) $ $ x \in \left [ l , r \right] (1 \le l \le r \le 10^9)$
$ (2) $ $ \exists $ $ i \in [1, n]$ $有 a_i \mid x (表示x 被 a_i 整除)$
问一共有多少个幸运数?
Input
第一行输入三个整数 $n, l, r (1 \le n \le 16, 1 \le l \le r \le 10^9)$ 。
第二行输入 $ n $ 个正整数 $a_i (1 \le a_i \le 10^9)$。
第二行输入 $ n $ 个正整数 $a_i (1 \le a_i \le 10^9)$。
Output
输出一个整数表示幸运数的个数。
Sample Input Copy
3 1 1000
5 6 8
Sample Output Copy
400