Loading repovive.com/contests/17/problems/B
Nasser gives you an array of length containing integers from to .
Your task is to count the number of ordered triples such that and the product is divisible by .
Note that the indices , , and are not required to be distinct. For example, is a valid triple, meaning you can use the same index more than once.
The first line contains a single integer () - the number of test cases.
For each test case:
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output a single integer - the number of ordered triples such that is divisible by .
, :
All triples :
| Triple | Calculation | Divisible by ? |
|---|---|---|
| Yes | ||
| Yes | ||
| Yes | ||
| Yes | ||
| Yes | ||
| Yes | ||
| Yes | ||
| Yes |