Problem Statement
Given a int[] a, return the number of integers between L and R, inclusive, that are divisible by at least one of the elements in a.
Definition
- Class:
- Divisibility
- Method:
- numDivisible
- Parameters:
- int, int, int[]
- Returns:
- int
- Method signature:
- int numDivisible(int L, int R, int[] a)
- (be sure your method is public)
Constraints
- L will be between 1 and 1000,000,000, inclusive.
- R will be between L and 1000,000,000, inclusive.
- a will contain between 1 and 18 elements, inclusive.
- Each element of a will be between 1 and 1000,000,000, inclusive.
Examples
293
784
{1}Returns: 492
255
734
{2}Returns: 240
579000
987654
{1,2}Returns: 408655
1
1000000000
{2,3}Returns: 666666667