1331 : D-C Problems

时间限制:1 Sec 内存限制:256 MiB 提交:22 正确:6

提交 状态 论坛

题目描述

Given n numbers, please count how many pairs of number which satisfy that the difference between the two numbers is equal to c. 

输入描述

The first line contains a number T representing the number of test cases. 

For each test case: The first line contains two positive integers n, c. The second line contains n integers , all the n integers are not more than $10^{9}$.

$T \leq 10$

$n \leq 200000, c \leq 10^9$ .

输出描述

For each test case: Print one integer in a single line, representing the number of pairs satisfy the difference between the two numbers is equal to c. 

样例输入

1
5 1
1 2 3 4 5

样例输出

4

来源

第二届湖北省赛