Two SigmaOA #2
Nums That Are Divisible by N
估计中等可在线判题
Count the index pairs with i<j such that a[i]+a[j] is divisible by N. Elements with duplicate values still have distinct identities, and an element cannot be paired with itself.
输入格式
The first line contains the array length n and the divisor N, and the second line contains n numbers. Complete original bounds: 1≤n≤100000, 1≤N≤10^9, 1≤a[i]≤10^9; output a 64-bit integer.
输出格式
Output one integer answer.
样例 1
输入:
5 3
5 4 3 2 1
输出:
4
样例 2
输入:
3 2
1 1 1
输出:
3
样例 3
输入:
1 3
3
输出:
0
样例说明
The first example has 4 pairs: original indices (0,1), (0,4), (1,3), and (3,4). The original explanation reversed the array without updating the indices accordingly; this site corrects it. The other two examples give 3 and 0.