代码如下
#include <iostream>
using namespace std;
int asd[111] = {0};
int ans = 0;
int main()
{
int n;
cin >> n;
long long store[n];
for (int i = 0;i < n;++i)
cin >> store[i];
for (int i = 0;i < n;++i)
{
for (int j = i + 1;j < n;++j)
{
for (int h = 0;h < n;++h)
if (store[i] + store[j] == store[h] && h != i && h != j)
if (asd[store[h]] != 1)
{
asd[store[h]] = 1;
++ans;
}
}
}
cout << ans;
return 0;
}