鸡你太美 • 3个月前
using namespace std; int a[M], b[m];
int main() {
int n, t, c = 0;
cin >> n;
for (int i = 0; i < 20005; i++)
b[i] = 0;
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
t = a[i] + a[j];
b[t]++;
}
}
for (int i = 0; i < 20005; i++) {
if (b[i] > 0) {
for (int j = 1; j <= n; j++) {
if (i == a[j]) {
c++;
break;
}
}
}
}
printf("%d", c);
return 0;
}
评论:
请先登录,才能进行评论