L2-017 人以群分

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a.begin() + 1, a.end());
    for (int i = 1; i <= n; i++) {
        a[i] += a[i - 1];
    }    
    cout << "Outgoing #: " << n / 2 + (n & 1) << "\n";
    cout << "Introverted #: " << n / 2 << "\n";
    cout << "Diff = " << abs((a[n] - a[n / 2]) - (a[n / 2])) << "\n";

    return 0;
}
posted @ 2022-03-18 19:57  Xxaj5  阅读(31)  评论(0编辑  收藏  举报