- A-B 数对
https://www.luogu.com.cn/problem/T417343?contestId=151796
- 2024-2-24 12:34:34 @
#include<bits/stdc++.h>
using namespace std;
int a[200001];
int main(){
int n;
cin>>n;
int k;
cin>>k;
int s=0;
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
for(int i=0;i<n;i++){
int *p=lower_bound(a,a+n,a[i]+k);
int *q=upper_bound(a,a+n,a[i]+k);
s+=q-p;
}
for(int i=1;i<=1000000;i*=10){
if(s/i==4){
cout<<0;
}
}
cout<<s;
}
2 comments
-
C23zhuanghaojun LV 6 @ 2024-2-24 17:27:13
怎么都92
-
2024-2-24 12:35:31@
不是0的问题
- 1
Information
- ID
- 996
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 8
- Tags
- # Submissions
- 132
- Accepted
- 23
- Uploaded By