#C7520. Count Special Triplets
Count Special Triplets
Count Special Triplets
You are given an array of integers of size N and an integer divisor X. Your task is to count the number of special triplets (i, j, k) with 0 ≤ i < j < k < N such that the sum of the elements at these indices is divisible by X. In other words, you need to count the number of triplets for which
The input is provided via standard input (stdin) and the result should be printed to standard output (stdout).
inputFormat
The first line contains two integers N and X, where N is the number of elements in the array and X is the divisor. The second line contains N space-separated integers that represent the array elements.
outputFormat
Output a single integer denoting the number of special triplets where the sum of the three numbers is divisible by X.## sample
6 5
1 2 3 4 5 6
4