文章
1
粉丝
0
获赞
2
访问
32
#include <bits/stdc++.h>
using namespace std;
int main(){
int bound=2000000;
int n,x;
cin>>n>>x;
int p;
int ans=0;
vector<int>hash(2*bound+1,0);
for(int i=0;i<n;i++){
cin>>p;
p=p+bound;
int m=p+x;
if(m>=1&&m<=2*bound){
ans+=hash[m];
}
m=p-x;
if(m>=1&&m<=2*bound){
ans+=hash[m];
}
if(p>...
登录后发布评论
暂无评论,来抢沙发