Algorithm

This commit is contained in:
e2hang
2025-08-30 21:59:50 +08:00
parent 9077007670
commit daeec35f97
13 changed files with 453 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
#include <set>
#include <iostream>
using namespace std;
int main(){
multiset<int> s;
int n, m;
cin >> n >> m;
int tmp;
for(int i = 0; i < n; i++){
cin >> tmp;
s.emplace(tmp);
}
int js = 0;
for(auto it = s.begin(); it != s.end(); it++){
js += s.count(*it - m);
}
cout << js << endl;
return 0;
}