mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
dd3af96771
4900-4999
31 lines
588 B
C++
31 lines
588 B
C++
#include<iostream>
|
|
#include<map>
|
|
#define ll long long
|
|
#define maxn 100+5
|
|
using namespace std;
|
|
ll a[maxn];
|
|
map<int,int>mapp;
|
|
int main()
|
|
{
|
|
int n;
|
|
while(cin>>n)
|
|
{
|
|
mapp.clear();
|
|
ll sum=0;
|
|
for(int i=0;i<n;i++)
|
|
{
|
|
cin>>a[i];
|
|
for(int j=0;j<i;j++)
|
|
{
|
|
if(mapp.find(a[i]+a[j])==mapp.end())
|
|
{
|
|
sum+=(a[i]+a[j]);
|
|
mapp[a[i]+a[j]]=1;
|
|
}
|
|
}
|
|
}
|
|
cout<<sum<<endl;
|
|
}
|
|
return 0;
|
|
}
|