4283: A-B问题

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:98 Solved:20

Description

给出一串正整数数列以及一个正整数 C,要求计算出所有满足 A−B=C 的数对的个数(不同位置的数字一样的数对算不同的数对)。

Input

输入共两行。
第一行,两个正整数 N,C。
第二行,N 个正整数,作为要求处理的那串数。

Output

一行,表示该串正整数中包含的满足 A−B=C 的数对的个数

Sample Input Copy

4 1
1 1 2 3

Sample Output Copy

3

HINT

对于 lns="http://www.w3.org/1998/Math/MathML">75\% 的数据,lns="http://www.w3.org/1998/Math/MathML">1 \leq N \leq 2000

对于 lns="http://www.w3.org/1998/Math/MathML">100\% 的数据,lns="http://www.w3.org/1998/Math/MathML">1 \leq N \leq 2 \times 10^5lns="http://www.w3.org/1998/Math/MathML">0 \leq a_i <2^{30},lns="http://www.w3.org/1998/Math/MathML">1 \leq C < 2^{30}


Source/Category