Skip to content

Commit

Permalink
Add 15234.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Jun 17, 2024
1 parent 86faf32 commit 1da658c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 15xxx/15234.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;

void solve(void) {
int n, k; cin >> n >> k;
vector<int> v(n);
for (int i=0; i<n; i++) cin >> v[i];

unordered_map<int, int> m;
for (int i=0; i<n-1; i++) for (int j=i+1; j<n; j++) {
m[v[i]+v[j]]++;
}
cout << m[k];
}

int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);

solve();
return 0;
}

0 comments on commit 1da658c

Please sign in to comment.