mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-10 06:18:48 +00:00
P1102 A-B 数对
R39856779
This commit is contained in:
parent
22662275f5
commit
80d695997a
19
problem/P1102/P1102.cpp
Normal file
19
problem/P1102/P1102.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
long long n, c, ans = 0;
|
||||
int a[200005];
|
||||
map<int, int> b;
|
||||
cin >> n >> c;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i];
|
||||
b[a[i]]++;
|
||||
}
|
||||
for (int i = 1; i <= n; i++) {
|
||||
ans += b[a[i] + c];
|
||||
}
|
||||
cout << ans << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user