题解
2023-08-12 15:53:32
发布于:浙江
11阅读
0回复
0点赞
#include <iostream>
using namespace std;
int n, sum;
int a[10000];
int b[10000];
int main() {
long long count = 0;
cin >> n >> sum;
for (int i = 0; i < n; i++){
cin >> a[i];
}
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
b[a[i] + a[j]];
}
}
for (int i = 0; i < n; i){
for (int j = 0; j < n; j++){
if (sum - a[i] - a[j] > 0){
count += b[sum - a[i] - a[j]];
}
}
}
cout << count;
return 0;
}
这里空空如也
有帮助,赞一个