report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Divisibility - FlandreOJ: Flandre Online Judge

Divisibility

Time limit: 1000 ms
Memory limit: 256 MB
Given $n$ prime numbers $P_1, P_2,\ldots, P_n$, count the number of integers in the range $[L,R]$ that are divisible by at least one prime in $P$. ### Input - The first line contains 3 integers $n, L, R$. - The second line contains $n$ primes $P_i$. ### Output - Print the answer. ### Constraints - $1 \le n \le 20$. - $1 \le P_i \le 10^{6}$. - $1 \le L \le R \le 10^{18}$. ### Example Input: ``` 2 5 14 3 5 ``` Output: ``` 5 ```
Inclusion-exclusion principle
Divisibility
Divisibility 2
Coprime query
GCD pairs counting
Good string pairs
Permutation problem
Restricted equation
Moving through matrix
Restricted equation 2
Binary matrix 2
Permutation Counting 2
Topic
Math
Bitmasks
Rating 1500
Solution (0) Solution