#P1102. A-B 数对
A-B 数对
Description
Given a sequence of positive integers and a positive integer , compute the number of pairs such that . Pairs with the same values at different positions are considered distinct.
Input Format
The input consists of two lines.
The first line contains two positive integers .
The second line contains positive integers, which form the sequence to be processed.
Output Format
Output one line containing the number of pairs in the sequence that satisfy .
4 1
1 1 2 3
3
Hint
Constraints:
- For of the testdata, .
- For of the testdata, , , .
Two new testdata sets were added on 2017/4/29.
Translated by ChatGPT 5
京公网安备 11011102002149号