https://www.nowcoder.com/acm/contest/201/E
排个序
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
#define LL long long int
LL a[1000100];
int main()
{
int n, m;
while (~scanf("%d%d", &n, &m))
{
for (int i = 0;i < n;i++)
scanf("%lld", &a[i]);
sort(a, a + n);
int res = n;
for (int i = 1;i < n;i++)
{
if (a[i] - m <= a[i - 1])
res--;
}
printf("%d\n", res);
}
return 0;
}