AC

zxy0416  •  26天前


include <bits/stdc++.h>

using namespace std; int a[105], ax[20005] = {0};

int main() {

int x, y, n, m, ans = 0;
cin >> n;
for (int j = 0; j < n; j++) {
	cin >> a[j];
}
for (int i = 0; i < n; i++) {
	for (int j = i + 1; j < n ; j++) {
		int sum = a[i] + a[j];
		ax[sum] = 1;
	}
}
for (int i = 0; i <= n; i++) {
	if (ax[a[i]] == 1) {
		ans++;
	}
}
cout << ans;
return 0;

}


评论:

请先登录,才能进行评论