JOIN
Get Time

   Problem Statement  

 Problem Statement for Divisibility

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

0)
    
293
784
{1}
Returns: 492
1)
    
255
734
{2}
Returns: 240
2)
    
579000
987654
{1,2}
Returns: 408655
3)
    
1
1000000000
{2,3}
Returns: 666666667

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.

This problem was used for:
       TCHS Single Round Match 16 Round 1 - Division I, Level Three