You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
562 B
23 lines
562 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
const int N = 110;
|
|
int n;
|
|
int a[N];
|
|
bool b[N];
|
|
int cnt;
|
|
|
|
int main() {
|
|
cin >> n;
|
|
for (int i = 1; i <= n; i++) cin >> a[i];
|
|
|
|
// c=a+b
|
|
for (int i = 1; i < n; i++) // 枚举两个数加法中的a,是小的那个
|
|
for (int j = i + 1; j <= n; j++) // 枚举两个数加法中的b,是大的那个
|
|
|
|
for (int k = 1; k <= n; k++) // 枚举结果数c
|
|
if (a[k] == a[i] + a[j] && !b[k]) cnt++, b[k] = true;
|
|
|
|
printf("%d", cnt);
|
|
return 0;
|
|
} |