Divisibility
Submissions: 801   Accuracy:

10.07%

  Difficulty: Medium   Marks: 4

Given an array arr[] of N elements and a number K. Your task is to count the number of integers from 1 to K which are divisible by atleast one of the elements of arr[].

Input:

First line of input consist of a single integer T denoting the total number of test case. Then T test cases follow. The first line of test case contains an integers N. Second line of test case contains N space separated integers denoting the array arr[]. Third line of test case contains an integer K.


Output:

For each test case output a single integer representing the solution to the given problem.


Constraints:

1<=T<=100

1<=N<=12

1<=a[i]<=20

1<=K<=10^18

Example:

Input:

1
2
2 3
10

Output:

7

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Pranay Pandey
Author: pra1nay7_313


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.