L2-017 人以群分
作者:
lvjj
,
2024-04-12 17:40:53
,
所有人可见
,
阅读 5
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int num;
vector<int> ve;
for(int i=0;i<n;i++){
cin>>num;
ve.push_back(num);
}
sort(ve.begin(),ve.end());
//以n/2-1作为边界
int sum=0;
for(int ii = n/2;ii<ve.size();ii++) sum+=ve[ii];
for(int ii = 0;ii<=n/2-1;ii++) sum-=ve[ii];
if(n%2==0)cout<<"Outgoing #: "<<n/2<<endl;
else cout<<"Outgoing #: "<<n/2+1<<endl;
cout<<"Introverted #: "<<n/2<<endl;
cout<<"Diff = "<<sum;
return 0;
}