- 问答
- 2018-05-24 20:43:17 @
#include<iostream>
#include<algorithm>
using namespace std;
int i, j, x;
int main()
{
int num,sum=0;
cin >> num;
int *remember=new int[num];
for (int i = 0; i < num; i++)
{
cin >> remember[i];
}
sort(remember, remember + num);
for ( i = 2; i < num; i++)
{
for ( j = 0; j <=i - 2; j++)
{
for ( x = j + 1; x<= i- 1; x++)
{
if ((remember[j] + remember[x]) == remember[i])
{
sum++;
}
}
}
}
cout << sum << endl;
//system("pause");
return 0;
}
0 条评论
目前还没有评论...