Rohan And Flowers

0

0 votes
Problem

My dear friend Rohan likes flower very much. One day someone gifted him a bunch of flowers and a cake. Each flower in the bunch has some beauty level B[i]. The cake also has sweetness level K. Now Rohan is slightly superstitious so he decided to pick three flowers from the bunch such that the product of their beauty is exactly divisible by the happiness of the cake. Now Rohan is wondering in how many ways he can accomplice this. He has asked you to help him.

Input:

An integer denoting number of flowers, N

On next line an integer denoting K

Next line contain N positive integers denoting the beauty of flowers.

Output:

Contains the required number of ways in one line.

Constraint:

2 < N < 2,000

0 < B[i] < 100,000,000

0 < K < 10,00,000

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Only two triplets are posiible

(25 2 4 ) = 200

(25 4 5) = 500

Editor Image

?