文章
5
粉丝
50
获赞
0
访问
1.9k
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
ll a[2000010], b[2000010];
int main()
{
ll n,x;
cin >> n >> x;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
sort(a+1, a + n+1);
for (int i = 1; i <= n; i++) {
b[i] = a[i] - a[i - 1];
}
ll ans = 0;
for (int i = 2; i <= n; i++) {
if (b[i] == x) {
ans++;
int j = i - 1;
while (j>1&&!b[j]) {
ans++;
&n...
登录后发布评论
暂无评论,来抢沙发