Dividing Mania
Practice
4 (1 votes)
Problem
18% Success 615 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Raghav has a beautiful array A of integers. He is very confident that he can answer any query related to this array. His friend challenges him to answer Q queries. Each query consists of an integer X.

Raghav has to tell the count of integers in his beautiful array which are perfectly divisible by X. Help Raghav to answer all queries.

Input:

First line has N, denoting the number of integers in array.

Next line contains N space separated integers in array A.

Next line has Q, denoting the number of queries.

Each of the next Q lines contains X.

Output:

For each query, print the number of integers which are perfectly divisible by X.

Constraints:

1 <= N <= 105

1 <= Q <= 106

1 <= X, A[ i ] <= 105, where A[ i ] denotes elements of array.

 

NOTE: Use printf/scanf for faster input/output.

 

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
2 votes
Tags:
Easy
Points:20
5 votes
Tags:
Ad-HocMathematicsOpenApprovedEasyMathamatics
Points:20
23 votes
Tags:
Ad-HocMathematicsOpenApprovedEasyMathamatics
Editorial

No editorial available for this problem.