Problem C
Integer Division
In C++ division with positive
integers always rounds down. Because of this, sometimes when
two integers are divided by the same divisor they become equal
even though they were originally not equal. For example in
C++,
Given a list of nonnegative integers and a divisor, how many pairs of distinct entries in the list are there that give the same result when both are divided by the divisor in C++?
Input
The first line of input contains two integers
The second line of input contains
Output
Display a single integer indicating the number of distinct
pairs of indices
Sample Input 1 | Sample Output 1 |
---|---|
5 4 4 5 6 7 8 |
6 |
Sample Input 2 | Sample Output 2 |
---|---|
5 1 4 5 6 7 8 |
0 |
Sample Input 3 | Sample Output 3 |
---|---|
6 1 1 2 1 2 1 2 |
6 |