問題一覧 > 通常問題

No.546 Only One

レベル : / AI推定難易度 : 1300 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 189
作問者 : nmnmnmnmnmnmnm / テスター : Pulmn
お気に入りにしたユーザー ProblemId : 1280 / 自分の提出
問題文最終更新日: 2026-06-25 15:14:28
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 169 (順位表) の他の問題:

Problem Statement

A-kun was given N distinct positive integers.

Among the positive integers between $L$ and $H$, inclusive,
how many are divisible by "exactly one" of the numbers A-kun has?

Input

$N$ $L$ $H$
$C_1\ C_2\ \dots\ C_N$

$N$ is a positive integer. $1\le N \le 10$.
$L$ and $H$ are positive integers. $1\le L \le H \le 1000000000 = 10^9$.
$C_i$ is the i-th number A-kun has. $1\le C_i \le 1000000000 = 10^9$.
All values of $C_i$ are distinct.

Output

Output the answer on one line.
Do not forget the newline at the end.

Sample

Sample 1
Input
2 1 10
2 3
Output
6

A-kun was given "2" and "3".
Among 1 to 10, the numbers divisible only by "2" are 2,4,8,10.
Among 1 to 10, the numbers divisible only by "3" are 3,9.
6 is divisible by both "2" and "3", so it is not included in the answer.
Therefore, the answer is the 6 numbers 2,3,4,8,9,10.

Sample 2
Input
3 40 42
2 4 5
Output
1

A-kun was given "2", "4", and "5".
40 is divisible by all of "2", "4", and "5", so it is not included in the answer.
41 is divisible by none of "2", "4", and "5", so it is not included in the answer.
42 is divisible only by "2", so it is included in the answer.
Therefore, the answer is 1.

Sample 3
Input
1 1 1000000000
1
Output
1000000000

A-kun was given "1".
All numbers from 1 to 1000000000 are divisible only by "1".

Sample 4
Input
4 999996000 999997000
14 49 8 98
Output
163

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。